2. The Basics
Now that we’ve covered the boring stuff, like compiling and executing your CoffeeScript, we will start covering how to actually write it. Let’s dive right in.
In this chapter we are going to examine the syntax of CoffeeScript. We’ll look at punctuation, scope, variables, and a few other choice bits.
Syntax
Much of CoffeeScript’s press has been due to its syntax, in particular its lack of punctuation. Punctuation such as curly braces and semicolons are extinct in the world of CoffeeScript, and parentheses are an endangered species.
To illustrate this point, let’s take a look at a bit of JavaScript that most of you might be familiar with. Here is a piece of jQuery code to make a remote AJAX request and do some work with the results: ...
Get Programming in CoffeeScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.