Do you know what will be the output of this code?
JavaScript
console.log(Math.max() < Math.min());
Show answer and explanation
When called without arguments, Math.max() returns -Infinity and Math.min() returns Infinity.
That’s because each function starts from the value that any other number will beat. Math.max starts at -Infinity and keeps the largest argument it sees, and Math.min starts at Infinity and keeps the smallest. With no arguments, the starting value is returned:
Math.max() // => -Infinity
Math.min() // => Infinity
-Infinity < Infinity
=> true