Tips for golfing in CoffeeScript What tricks do you know to make CoffeeScript code shorter?

CoffeeScript is language that compiles into JavaScript ("transpiles" into ES3, to be exact). The golden rule is "It's just JavaScript", meaning there's no runtime overhead. Most of JavaScript Tips &amp; Tricks apply as well.

As a side-effect that also means: developers coming from JavaScript (including myself) tend to use JavaScript constructs instead of shorter CoffeeScript alternatives.

This thread focuses on tips specific to CoffeeScript.

Links to related topics:

Tips for golfing in JavaScript

Tips for Golfing in ECMAScript 6 and above
Use destructuring assignments, if structure elements are used often

Eg. get elements of first argument array

func = ([x,y,z])-&gt;
    [i,j] = doSomething x, y, x+y
    doSomethingElse i, j

# instead of

func = (a)-&gt;
    b = doSomething a[0], a[1], a[0]+a[1]
    doSomethingElse b[0], b[1]


This can be combined with splats

[first, rest..., last] = doSmth()