Function to find the minimum value in Javascript Arrays


Sun Jan 05 2020 19:31:48 GMT+0000 (Coordinated Universal Time)

Saved by @bezequi #javascript #webdev #arrays #math

const arrMin = arr => Math.min(...arr);
// arrMin([20, 10, 5, 10]) -> 5


Math is a built in object in JavaScript that contains certain methods useful for performing mathematical tasks. One of these methods is min(). Math.min() , as expected, returns the smallest of any set of given numbers.