js min of array code example

Example 1: javascript min max array

Math.max(1, 2, 3)    // 3
Math.min(1, 2, 3)    // 1

var nums = [1, 2, 3]
Math.min(...nums)    // 1
Math.max(...nums)    // 3

Example 2: javascript minimum number in array

const min = arr => Math.min(...arr);

Example 3: js max value of array

let numbers = [4, 13, 27, 0, -5]; // Get max value of an array in Javascript

Math.max.apply(null, numbers); // returns 27

Example 4: min array javascript

const nums = [1, 2, 3]
Math.min(...nums)    // 1
Math.max(...nums)    // 3

Example 5: javascript math min array

const nums = [1, 2, 3]Math.min(...nums)    // 1Math.max(...nums)    // 3

Example 6: js return the highest and lowest number

console.log(Math.max(1, 3, 2));
// expected output: 3

console.log(Math.max(-1, -3, -2));
// expected output: -1

const array1 = [1, 3, 2];

console.log(Math.max(...array1));
// expected output: 3