A number of languages compile to JavaScript, making code easier to write. (You can find a fairly comprehensive list at http://altjs.org.) This book isn’t about them. It’s about writing the best JavaScript code we can without the use of a precompiler. I have nothing against altJS (see the next section), but I believe it’s important to understand the underlying language.
Some altJS languages are aimed specifically at “taming” async callbacks by allowing them to be written in a more synchronous style. I’ve included an overview of these languages in Appendix 1, Tools for Taming JavaScript.
It’s no secret that I ♥ CoffeeScript, a beautiful and expressive language that compiles to JavaScript. I use it extensively in my day-to-day work at HubSpot. I’ve given talks on it at conferences like Railsconf and Øredev. And it was the subject of my first book, CoffeeScript: Accelerated JavaScript Development.[13]
But when I started writing the book you’re reading now, I decided that doing it in CoffeeScript would needlessly limit its appeal. By and large, CoffeeScripters understand JavaScript perfectly well, whereas code like square = (x) => x * x might as well be hieroglyphics to JavaScript purists.[14]
So, if you’re a CoffeeScripter, my apologies for the curly braces. Rest assured that the lessons you draw from this book will carry over to any altJS language.
18.225.56.233