Recipe 31Cleaner JavaScript with CoffeeScript

Problem

JavaScript is the programming language of the web, but it’s often misunderstood, which leads to poorly written and terribly performing code. Its rules and syntax can lead to developer confusion and frustration, which slow down productivity. Since JavaScript is everywhere, we can’t simply remove it or replace it with a language with a more comfortable syntax.

Ingredients

  • CoffeeScript[86]

  • Node.js[87] and npm

  • QEDServer (for our test server)[88]

Solution

We can use other languages to generate good, standard, and well-performing JavaScript. Several solutions make writing JavaScript more enjoyable, including the forthcoming ECMAScript 6 standard (ES6), which brings new syntax and language features. ...

Get Web Development Recipes, 2nd Edition 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.