arr = [11, 10, 10];
var index = arr.indexOf(Math.max(...arr));
// Assuming the array is all integers,
// Math.min works as long as you use the spread operator(...).
let arrayOfIntegers = [9, 4, 5, 6, 3];
let min = Math.min(...arrayOfIntegers);
// => 3
var min = Math.min.apply(null, arr),
max = Math.max.apply(null, arr);
(function () {
const arr = [23, 65, 3, 19, 42, 74, 56, -42, 8, 88];
// const arr = [];
function findMinValue(arr) {
if (arr.length) {
let min = Infinity;
for (let num of arr) {
min = num < min ? num : min;
}
return min;
}
return 0; // or anything what you need
}
console.log(findMinValue(arr)); // => -42
})();