how to find smallest and largest number in an array based on indices in 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: js get smallest value of array
Array.min = function( array ){
return Math.min.apply( Math, array );
};
var minimum = Array.min(array);