O'Reilly logo

Web Development Recipes, 2nd Edition by Chris Johnson, Mike Weber, Chris Warren, Brian P. Hogan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required