8
1
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 & 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:
Can coffeescript compile to ES6? Is it compatible? – proud haskeller – 2015-08-09T14:56:43.890
@proudhaskeller It compiles into ES3 in general, with one exception: if you
yield
, it compiles into ES6 generator. Otherwise it tries to be as browser-compliant as possible. – metalim – 2015-08-09T18:47:47.723