CoffeeScript Is Just JavaScript

For those of you unfamiliar with CoffeeScript, it is a language that compiles to JavaScript. There are both benefits and downsides to using CoffeeScript, but I’m not going to talk about those since everyone else on the Internet already has. There is only one point that I want to mention – and it’s an important one so pay attention.

It’s Just JavaScript

Most people I talk to who haven’t yet taken the time to learn CoffeeScript treat it like it’s a completely new language. I’ll often hear questions like “can I do X?”, or “does library Y work with CoffeeScript?” The answer to both of these is “Yes, It’s just JavaScript!” referencing scope, passing callbacks, using JQuery; It’s all the same, just written with different syntax.

So next time you find yourself asking if it’s possible to do something in CoffeeScript, first ask yourself “how would I do this in JavaScript?” If you can think of a way, you can do it in CoffeeScript. The only difference is that sometimes CoffeeScript has shortcuts to make things more concise, however there’s nothing preventing you from doing things the long way.

Parting Words

In summary, think of CoffeeScript not as a language, but a framework. Moving from JavaScript to CoffeeScript is like writing a web server from scratch, then switching to a web framework; You simply move from a lower level of abstraction to a higher one.

Understanding this point has helped convert me from a skeptic to a believer. I’m still not 100% convinced that CoffeeScript is the silver bullet, but the language features are really making it hard to go back to JS. We’ll see how I feel in a few more months though.

javascript explanation