> typeof NaN < "number"
no shit?
> 9999999999999999 < 10000000000000000
integers bigger than 9007199254740992 can’t be represented exactly
> 0.5+0.1==0.6 < true > 0.1+0.2==0.3 < false
Not a JS problem, floating point comparison is wonky as fuck. As a general rule, you shouldn’t assume that two non-integers will be equal.
> Math.max() < -Infinity > Math.min() < Infinity
so?
> []+[] < "" > []+{} < "[object Object]"
binary + can’t use number conversion here
> {}+[] < 0
{} is a block declaration, not an object; + is unary here, it always converts its operand to a number
> true+true+true==3 < true
(number)true+(number)true+(number)true==3, true has a value 1
> true-true < 0
same
> true==1 < true > true===1 < false
THIS IS LITERALLY THE POINT
> (!+[]+[]+![]).length < 9
this one is intentionally confusing, ! converts its operand to a boolean, any value except 0 is converted to true: !0+[]+![] -> !false+[]+!true, binary + then converts it to a string “truefalse”
> 9+"1" < "91"
binary + with a string always uses conversion to string
> 91-"1" < 90
binary - always tries number conversion first
> []==0 < true
[] is coerced to a number
I draw, code, and make memes sometimes.