I'm a reasonably experienced programmer trying to learn web developement. I'm trying to develop a client-side web application which uses svg or canvas for graphics. I've decided I'd like to write the application code in Coffeescript. I don't know either Javascript or Coffeescript.

How necessary knowing Javascript to Coffeescript web development? Am I likely to hit some gnarly problem which requires me to understand Javascript? Can I work happily with Javascript APIs from Coffeescript?

Edit: I could easily learn the basics of Javascript in a week. I'm more concerned that Javascript seems to have a lot of hidden sharp edges. In the strangest language feature question on StackOverflow Javascript is one of the most common languages. It has an unusual object and class model. It has non-obvious name scoping rules. I find it takes more than a week for me to really know a language.

I'm going to work on a small simple project to learn web development. Would I be better off to use Javascript or Coffeescript? I think in the long run I'll prefer Coffeescript but I'm willing to start with Javascript if that I'm going to need a thorough understanding of Javascript to use Coffeescript.

  • Keep in mind that CoffeeScript simply compiles to JavaScript. While CS makes it easier to manage some of the nuances of JavaScript, it doesn't relive them; its still subject to all the same functionality and quirks. For example, the class keyword in CS doesn't do anything magical; it simply uses JavaScripts native prototypal inheritance mechanisms. For this reason, I'd recommend having at least an ancillary knowledge of some of JavaScripts more obscure "features". Aug 23, 2011 at 7:54
  • 2
    CS isn't a magic silver bullet that makes everything easier, it's JS with a different syntax. Whether you write JS or CS is a style preference.
    – Raynos
    Aug 23, 2011 at 12:10

6 Answers 6


I guess it wouldn't be absolutely necessary, but you'd hit roadblocks in the long-run if you don't.

You need to understand what's happening under the hood and what the CoffeeScript compiler transcribes to, as that's what the browsers (assuming we're talking about using CoffeeScript in a browser environment) will need to interpret. Which means it's also what you'll need to debug, especially considering CoffeeScript is fairly recent and we may still come across some rough edges and bugs in its transcription mechanism. Also, if not using any bespoke debugging tools for debugging, you'll need to jump through the generated JavaScript code to debug using Firebug or Chrome Dev Tools or your JS console of choice. In some cases you'll be able to see how the JS error relates directly to the source CoffeeScript statement. In others, as the transcription is non-trivial, it will be difficult to understand.

Take it this way: you can very well develop software in Java and C# without having ever done any low-level development. Yet you'd have a very bad time understanding what's happening and why you hit performance bottlenecks and memory issues if you have no clue and are unable to make an educated guess about what these languages' runtimes need to do for you in the background, and what part of the guesswork they may screw up because they simply cannot pull off miracles.

Additionally, if you learn JavaScript, you'll get to realize how incredibly more difficult it can than it originally seems, and you'll appreciate CoffeeScript for its terse and clean syntax even more :)

  • 1
    Or you'll be annoyed at CoffeeScript for not being JavaScript ;). ES5 is a lovely language.
    – Raynos
    Aug 23, 2011 at 12:07
  • @Raynos: lipstick on a pig, still a pig; tuxido on a goat, still a goat, etc... :) I agree that ECMAScript is actually a very interesting language once you get to know it, but it has way too many inconsistencies and traps and pitfalls that make it a burden for both new learners and even for advanced programmers. Still, it's our modern web lingua franca, and it's improving and maturing over time. I do like the idea of CoffeeScript as it hides some annoying things of ECMAScript, pretty much the same way that using some libs for Java (or even a language on top of it) make it bearable.
    – haylem
    Aug 23, 2011 at 14:55
  • 2
    Meh, you just need to read the Good Parts and your good to go. The pitfalls aren't that hard to avoid.
    – Raynos
    Aug 23, 2011 at 14:58
  • @Raynos: Yet I struggle to find advanced JS developers to hire, unfortunately. Really good ones are quite hard to find.
    – haylem
    Aug 23, 2011 at 23:39
  • Oh I agree, the JS community is saturated with mediocre developers. I don't where you should find them. I only know a few good developers from the JS chat.SO room. I guess by the sheer fact there aren't any good JS developers, JS must be hard. I just think no-one bothers to learn it properly.
    – Raynos
    Aug 23, 2011 at 23:46

You ask:

Am I likely to hit some gnarly problem which requires me to understand Javascript?

I can say, unequivocally, yes. In general, if you are doing anything interesting, at some point you will at least need to understand what is going on in the levels below you. (Sometimes Google + cut + paste can save you, but you don't want to be that guy.)

Any "reasonably experienced programmer" then picking up a new language should not take you very long. JavaScript is a fairly simple language. Anything difficult about it comes from the environment it is executing in: namely, several different web browsers with different ideas how to do things.

A lot of the "how to" information you will find on the web will be written with JavaScript in mind, so you will probably have an easier time if you learn how to read JavaScript and translate it into the equivalent CoffeeScript.

Honestly, unless you deliberately try to remain ignorant, you will probably wind up learning JavaScript as a side effect of working in CoffeeScript. So just get started already.


Because "The golden rule of CoffeeScript is: 'It's just JavaScript'," I do recommend at least a basic familiarity with JavaScript. In particular, have a look at Douglas Crockford's little book, JavaScript: The Good Parts. You can also watch Crockford's own great introductory presentation about it.

CoffeeScript basically wraps the good parts of JavaScript in a different package: "CoffeeScript is a simple thought experiment to imagine a language that exposes a minimal syntax for the beautiful object model that underlies JavaScript." You don't need to know all the details, just enough to understand that JavaScript, itself, is not a class-based object-oriented language. It has no classes at all. Instead, it uses "prototypes," and that makes for some differences from other OO languages. Jeremy Ashkenas cleaned up some of the bad parts of JavaScript syntax, added some enhancements, and made it a bit more Python-esque.

JavaScript has some well-known "gotchas" to watch out for. Otherwise, it's a great language and is in very common use, today. We wouldn't have AJAX or jQuery without it, among other things.

Good luck with your CoffeeScript!

  • Buy the good parts. Don't be a cheapskate!
    – Raynos
    Aug 23, 2011 at 15:30
  • @Raynos - I did. I'm not! :D But I deleted the potentially inappropriate search suggestion. Thanks for pointing it out! Aug 23, 2011 at 16:33

Yes. It isn't the end of the world if you don't, but yes.

Why? Well first, JavaScript is really easy to learn. It literally took me 4 days to learn it (well, most of it). Also, I believe it is more valuable than CoffeeScript. I really don't think you even need CoffeScript. But it is still a good tool.

  • 3
    I've been learning JavaScript for years, and I still wouldn't say I truly know it. Once in a while I discover things about it that surprise me. It might be easy to learn how to do "Hello World", but learning to predict the behavior of implicit type conversion and closures is not.
    – Zach
    Aug 23, 2011 at 4:01
  • @Zach You may be interested in the book JavaScript Enlightenment. One review reads: "In fact, I really couldn’t find anything missing. If you’ve ever wondered why JSLint is complaining about something, the root cause is likely to be explained somewhere in this book." Aug 23, 2011 at 7:49
  • 1
    @Zach closures aren't that hard, type conversion is a pain. The big problem with JS is knowing what older versions of IE are doing.
    – Raynos
    Aug 23, 2011 at 12:08
  • @Zach: I know I don't know all of Javascript. I'm not even close. But I do know that the basics and some of the intermediate stuff is very easy to learn.
    – Dynamic
    Aug 23, 2011 at 13:34

It depends.

If CoffeeScript abstracts JavaScript enough, so that you don't need to know it (like C# abstracting Intermediate Language), then yeah, you can do whatever you like to do in CoffeeScript without learning JavaScript.

But my experience tells me that no matter how much I try to flee from JavaScript, when it comes to client, I sometimes really need to get my hands dirty and write pure JavaScript.

Yeah, you're right. while JavaScript syntax is easy and you can learn it in a weak, but it takes you years to master.

IMHO, as I see CoffeeScript, it's not mature enough to wrap all JavaScript intricacies totally. So, I don't risk not learning or working directly with JavaScript.

  • CoffeeScript is a very thin abstraction. You can learn coffeescript directly but debugging compiled js will be a pain. "get my hands dirty and write pure javascript". JavaScript isn't dirty.
    – Raynos
    Aug 23, 2011 at 12:09
  • 1
    @Rayons, I didn't mean that JavaScript is dirty. :). This is kind'of an expression meaning that you should get to deeper underlying layers. Aug 23, 2011 at 12:33
  • that's like saying "I'm doing some Game Programming, best get my hands dirty and write c++" or "I'm doing some AI, best get my hands dirty and write LISP". The only deeper underlying layer we have in the browser is NaCl
    – Raynos
    Aug 23, 2011 at 12:45

The coffeescript documentation defines coffescript in terms of the equivalent javascript. If you do not understand javascript, you will not understand coffeescript either.

Not the answer you're looking for? Browse other questions tagged or ask your own question.