CoffeeScript has gotten pretty popular in the past 6 months or so. If you're not familiar with it, be sure to check out the language's website. It's basically a language that compiles to JavaScript. So you can write your client-side code in CoffeeScript, but still have the browser execute the resulting JavaScript. Or if you're using Node.js, you can just use CoffeeScript instead of JavaScript if you prefer. It doesn't matter, it's all JavaScript in the end.
To the many people who dislike JavaScript, either because of its syntax or its many pitfalls (or both), CoffeeScript is obviously great. They can get in on all the fun and progress that's happening in the JavaScript world, without having to write JavaScript themselves. Purely from a syntactical point of view, it's hard to argue the merits and benefits of the language. I'm fond of Ruby's syntax, so instinctively CoffeeScript looks much more appealing to me than JavaScript. Despite the nice syntax and protection from JavaScript's pitfalls, I still prefer to code in JavaScript.
For starters, if you're doing JavaScript development (whether client-side or server-side), you're likely to use a variety of scripts or libraries written by people other than you. While some libraries are documented very nicely, others aren't. In many cases, I still find the ability to read the source code of a library I'm using to find what I want to know to be a very valuable benefit. I've noticed that I often do this when trying to find out how to do something that I can't find in the documentation, or when I'm troubleshooting something. If you're not familiar with commonly used JavaScript patterns, this becomes harder than it needs to be. Some subtleties might pass you by, or in some cases you might have outright difficulties comprehending the code. Of course, reading JavaScript code from seasoned JavaScript developers can also be a great learning experience about how to properly use the language. Yes, there's a lot of bad JavaScript available, but there's a lot of beautiful JavaScript around as well. I'd say the benefits you can get from reading the code of the libraries you use are directly dependent on your familiarity with JavaScript as a language, as well as its most common used patterns and idioms. If you try to avoid JavaScript by sticking with CoffeeScript, you sort of limit the potential benefits to be had from a tremendously valuable resource.
Another reason is that JavaScript is gradually becoming ubiquitous and that's all the more reason to maintain your familiarity with the language. You're unlikely to build a website without a nice dose of JavaScript, either used directly or through CoffeeScript. Server-side JavaScript usage is on the rise, and the growing popularity of Node.js is only going to increase the usage. True, you can use CoffeeScript with Node.js as well, but keep in mind that you're going to be reading a lot of other people's JavaScript code when you work with Node.js. That's not a slight at Node.js as a platform or development community btw, I very much enjoy working with it and am loving the learning experience. JavaScript is also being used in a few NoSQL databases, and in those cases it's harder to avoid it. Who knows where JavaScript is going to be used in the future? Will you always have the ability to 'compile' your CoffeeScript code to JavaScript in order to take advantage of whatever new environment where it can be used? Maybe you will, maybe you won't. Who knows? What you do know is that the vast majority of documentation and information you're going to find on the internet will be using JavaScript. Again, all the more reasons to become proficient in JavaScript IMO.
Then there's the aspect of debugging and troubleshooting. While you can indeed 'compile' your CoffeeScript code to JavaScript, none of the debuggers available at the moment transform your code back to CoffeeScript at runtime if you're trying to debug something. Ok sure, we all prefer to avoid debugging by writing proper tests but the fact of the matter is this: if something goes wrong, I certainly want to understand the code that I can debug. And even more so, I want that code to be readable and not look like it was generated by a tool (and I'm not talking about a lousy developer). Or if I receive a stacktrace from a tester or (gasp) a user, I would like to be able to look at the code that is listed in the stacktrace without thinking "oh crap, what the hell is going on here? I'm not used to all this JavaScript!!".
Again, I have no issues with CoffeeScript as a language. I like its syntax and the ideas behind it. But for me, that just doesn't outweigh the downsides that I've listed here so I'll be sticking with JavaScript for quite a while longer, me thinks.
Pingback: Elegant D » Why I Prefer JavaScript Over CoffeeScript
Pingback: The Morning Brew - Chris Alcock » The Morning Brew #935
Pingback: CoffeeScript or JavaScript ? | phato.blog