js find min value in array code example
Example 1: javascript get minimum value in array
var arr = [5,1,9,5,7];
var min = Math.min(...arr);
console.log(min);
var arr = [5,1,9,5,7];
var min = Math.max(...arr);
console.log(min);
Example 2: javascript index of min value in array
arr = [11, 10, 10];
var index = arr.indexOf(Math.max(...arr));
Example 3: javascript find the min in array of numbers
let arrayOfIntegers = [9, 4, 5, 6, 3];
let min = Math.min(...arrayOfIntegers);
Example 4: Math max with array js
var nums = [1, 2, 3]
Math.min.apply(Math, nums)
Math.max.apply(Math, nums)
Math.min.apply(null, nums)
Math.max.apply(null, nums)