find min value in the array js code example
Example 1: javascript find smallest number in an array
const arr = [14, 58, 20, 77, 66, 82, 42, 67, 42, 4]
const min = Math.min(...arr)
console.log(min)
Example 2: how to return the max and min of an array in javascript
function minMax(arr) {
return [Math.min(...arr), Math.max(...arr)];
}