Compute Min in JavaScript

Posted by yhuang
Public (Editable by Users)
JavaScript
None
Edit
console.log(Math.min(2, 3, 1));
// expected output: 1

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

var array1 = [2, 3, 1];

console.log(Math.min(...array1));
// expected output: 1