Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
CoffeeScript is a programming language that looks like this:
hello = (name) ->
alert "Hello, #{name}!"
hello "World"
Here, we’re defining and then calling a function,
hello, which accepts a single parameter,
name, and is displayed in an annoying fashion on the
screen (via alert). If you’re a coder, you’ve probably
identified a few interesting elements in this piece of code. Indeed, one of
this book’s goals is to thoroughly explore the syntactic and pragmatic
choices that make CoffeeScript an interesting programming language.
CoffeeScript occupies a weird space in the programming language landscape: it was designed from the beginning to piggyback on top of JavaScript, the de facto language of the Web. CoffeeScript code is transpiled (or transcompiled) directly into JavaScript code, a cunning trick to leverage the ubiquity of the web browser as an execution environment. This means that CoffeeScript runs wherever JavaScript runs, and can do whatever JavaScript can do. And with the rise of technologies like Node.js and HTML5, that’s a lot of places and a lot of functionality.