how to find the largest number in array javascript 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: javascript largest number in array
const max = arr => Math.max(...arr);
Example 3: get largest number in array javascript
const array1 = [1, 3, 2];
Math.max(...array1);
// expected output: 3