Monday, 12 March 2012

CoffeeScript

== vs ===
Because the == operator frequently causes undesirable coersion, is intransitive, CoffeeScript compiles == into ===, and != into !==. In addition, is compiles into ===, and isnt into !==.

A good explanation of the difference between == and === in JavaScript is here.

=> vs ->
=> is the "bound" function operator". When this/@ variable is used in a function, you need to think carefully about which context you want this variable to be bound to. When -> is used, this/@ will refer to whichever the current context is when the function is called; when => is used, this/@ always refers to the context when the function is defined.