Comment on Strangest Programming Language Feature?parentComments−runlevel112yIt'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[2]: http://www.ecma-international.org/ecma-262/5.1/#sec-11.8EDIT: Forgot to include 'is' and 'isnt' operators.
Comments
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]
[1]: http://coffeescript.org/#operators[2]: http://www.ecma-international.org/ecma-262/5.1/#sec-11.8
EDIT: Forgot to include 'is' and 'isnt' operators.