WTFJS
The weirdest tech I've ever always used
@marcos_placona
marcos@twilio.com
Why aren't you talking about Dart?
Dart is cool...
... you just don't get it...
https://github.com/mplacona/dart_matrix
about 50 lines later in Dart...
JavaScript can be an odd (f|d)uck sometimes
> x=[0] => [0]
> x == x => true
good...
still good...
> x==!x => true
still goo.. Wait what?
x is equals x...
... but also different
> 1+2==3 => true
> 0.5+0.7==1.2 => true
you nailed it!
> 0.1+0.2==0.3 => false
wait a minute...
math is hard...
... and even JS doesn't get it
> true+true===2 => true
> true-true===0 => true
basic maths...
and it's consistent! I think true is === 1 right?
> true===1 => false
Doh!
> typeof null => 'object'
> typeof NaN => 'number'
when null is not actually null
NaN (not a number) is in fact a number
NaN with an identity crisis
> NaN===NaN => false
true != true
> 'true'==true => false
round it up!
> 9999999999999999 => 10000000000000000 /* nine quadrillion, nine hundred ninety-nine trillion, nine hundred ninety-nine billion, nine hundred ninety-nine million, nine hundred ninety-nine thousand, nine hundred ninety-nine */
=> JS
Thanks
By Marcos Placona