STN
0
Q:

Math max with array js

const min = arr => Math.min(...arr);
4
let numbers = [4, 13, 27, 0, -5]; // Get max value of an array in Javascript

Math.max.apply(null, numbers); // returns 27
2
var values = [3, 5, 6, 1, 4];

var max_value = Math.max(...values); //6
var min_value = Math.min(...values); //1
0
var nums = [1, 2, 3]
Math.min.apply(Math, nums)    // 1
Math.max.apply(Math, nums)    // 3
Math.min.apply(null, nums)    // 1
Math.max.apply(null, nums)    // 3
0

New to Communities?

Join the community