You would think that as the creator of Backbone (and Underscore and Docco), Jeremy Ashkenas would have enough on his hands … but you'd be wrong. Somewhere in between creating these three libraries, Jeremy also found the time to create an entirely new programming language called CoffeeScript (http://coffeescript.org/).
CoffeeScript is interesting to many web developers because of the following two key features:
CoffeeScript compiles to JavaScript, which means that you can use it for development but then compile it into a language that your user's browsers can actually understand.
CoffeeScript offers a syntax and feature set that have more in common with languages such as Python or Ruby than with "vanilla" JavaScript.
This is best explained by example. Here's how you would create a View
class for an h1
element in CoffeeScript:
class HeaderView extends Backbone.View tagName: 'h1' initialize: -> @render render: -> $(@el).text 'Hello...