Introduction

If you have bought this book, or at least picked it up because it interested you, then you have at least heard of CoffeeScript and have an inkling of what the language is. In the words of its author, “CoffeeScript is a little language that compiles into JavaScript,” and in a sense, that is all you need to know about the language. But a number of more profound ideas follow from that simple concept.

To understand CoffeeScript properly, it’s important to understand the history of JavaScript. In the early days of Netscape Navigator, an engineer by the name of Brendan Eich was given the task of writing a scripting language that the browser would interpret, along with only two guiding principles. First, the language needed to look like Java, because that was the cool language at the time. Second, he had only ten days to write a functioning implementation.

That was a tremendously tall order but one that Eich was equal to. He created a small, language that fulfilled looked and acted like Java, called “Mocha”. Additionally, he made decisions that set the language apart from others, such as treating functions as first-class objects that could be passed around at will and using prototypical object inheritance rather than the classical style preferred by the likes of C++ and Java. JavaScript, as it was eventually called, saw its first release in 1995 as part of Netscape Navigator 2.0.

In early 2000, Microsoft released a new version of its web e-mail/calendaring client, Outlook ...

Get Smashing 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.