math.min in js code example
Example 1: js math function that returns smallest value
console.log(Math.min(2, 3, 1));
// expected output: 1
console.log(Math.min(-2, -3, -1));
// expected output: -3
const array1 = [2, 3, 1];
console.log(Math.min(...array1));
// expected output: 1
Example 2: math js min
var x = 10, y = -20;
var z = Math.min(x, y); //z = y