3 ms·
It's because equality comparisons in CoffeeScript (==, !=, is, isnt) are always compiled into strict (non-type-converting) comparisons (===, !==). [1] JavaScri
by runlevel1 13y ago
It's because equality comparisons in CoffeeScript (==, !=, is, isnt) are always compiled into strict (non-type-converting) comparisons (===, !==). [1]
JavaScript doesn't have strict relational operators (>, <, >=, <=), so all relational comparisons undergo type-conversion. [2]
CoffeeScript: 0 <= "" <= 0 # True
JavaScript: (0 <= "" && "" <= 0); // True
CoffeeScript: "" is 0 # False
JavaScript: "" === 0; // False
[1]: http://coffeescript.org/#operators http://coffeescript.org/#operators
[2]: http://www.ecma-international.org/ecma-262/5.1/#sec-11.8 http://www.ecma-international.org/ecma-262/5.1/#sec-11.8
EDIT: Forgot to include 'is' and 'isnt' operators.