created by Brian LeRoux & Andrew Lunny. sparodically uncurated by David Trejo.

2011 06 27 min less max

This beauty is courtesy of TiTi ...lets look at some code.

    Math.max();
    // -Infinity

    Math.min();
    // Infinity

Ok, so, there is a good reason for this behaviour. It might even make sense if you happen to occasionally omit args from your min/max calls. ;)

You see, the min/max implementations need something to compare to and Infinity and -Infinity are the only safe values to use for that comparison. @kriskowell goes into more better detail here and was quickly followed by @brendaneich who not only wrote js in 10 days but can rock out unicode Infinity symbols without looking them up ...I shit you not.

Of course, due to this behaviour js allows for this code humour:

    Math.min() < Math.max();
    // false

Oh JavaScript, I still love you.

Fork me on GitHub