Answers for "Math object methods are Math.min() and Math.max()"

0

Math object methods are Math.min() and Math.max()

console.log(Math.min(1, 2, 3));  // 1
console.log(Math.max(1, 2, 3));  // 3

// If one of the objects can't be converted, the result is NaN:
console.log(Math.min(1, 2, 'Hello!'));  // NaN
console.log(Math.max(1, 2, 'Hello!'));  // NaN

// If you give .min() nothing, you get Infinity:
console.log(Math.min());  // Infinity

// If you give .max() nothing, you get -Infinity:
console.log(Math.max());  // -Infinity
Posted by: Guest on April-17-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language