Skip to content
epeli edited this page Jan 12, 2012 · 11 revisions

CoffeeScript

Must know

  1. Variables
  2. Safety closure
  3. Functions
  • implicit return, calling with objects, calling with multible callbacks
  1. No coercion issues is is alway ===
  2. Loops, while, for v in arr, for k, v of ob, for own k, v of ob
  3. Binding function aka Fat arrow =>
  4. Everything is an expression
numbers = for i in [0..10]
  i * 2
  1. Classes and prototypes
  2. Works well with plain Javascript

Nice things

  1. Existential Operator foo?.bar
  2. Destructing Assignment {Foo} = require "bar", [host, port] = getConfig
  3. List Comprehensions (i for i in [0..100] when i > 50)
  4. and, or, is, isnt, not instead of ===, &&, || etc.
  5. Multiline strings. Regexp too.
  6. String interpolation. "I have #{ variable }"
  7. Array slicing numbers[numbers.length/2...numbers.length]

Clone this wiki locally