Ask HN: Javascript or CoffeeScript for a newbie?
I am starting to learn javascript. I think CoffeeScript is easier to write and read. Do you guys recommend learning javascript using CoffeeScript ? Absolutely javascript. You'll be making a mistake by using CoffeeScript first. It's very important to understand the underlying language before using a meta language like CoffeeScript. I tried to use CS first and found that I needed to really understand JS in order to debug stuff that didn't work, and you get a lot of that with DOM. So I've learnt a fair bit of JS and now I just can't be bothered to write in CS, JS is really not that bad if you understand that JS is NOT class-oriented and CS ends up only obscuring reality, not altering it. Which brings me back to why I had to learn JS in the first place. It's not like CoffeeScript really forces you to use classes. It's not an object-oriented language. It's just Javascript with a ruby-like syntax. Even the class keyword is just some monkey-patching (and a commonly-used method of doing it) of the prototype system to support some pseudo-inheritance. 100% of what you learn in CoffeeScript is applicable to Javascript, and viceversa. The real pain, is like you said, debugging applications. I can't just write coffeescript into the console, not even a little`console.log`which is infinitely nicer without the parentheses. I had the bare fundamentals of JavaScript down (constructors, the prototype object, anonymous functions/callbacks) and I did quite well once switching to CoffeeScript. I really recommend using the coffeescript.org "Try CoffeeScript" feature so you can see what your CoffeeScript gets compiled into. One thing I wish I understood better going into it was function scope or scope in general, I remember getting caught up on this quite a bit. I definitely have an easier time turning my thought into code using CoffeeScript, YMMV. There's a great free e-Book hosted on GitHub that is written by Alex MacCaw. I recommend checking it out. Here's the link: http://arcturo.github.io/library/coffeescript/ I would recommend javascript. Coffeescript is just a "prettier" syntax for javascript but in the end it just compiles down to js. Learn JS and learn to write good JS! I personally hate CS because I some people take that route to avoid writing clean JS, just because CS looks nicer. Once you truly learn how js works, migrating to CS will be very simple. Javascript, hands down. You'll have a harder time going from CS -> JS than you will from JS -> CS, and knowing only CoffeeScript really narrows what you can do It depends on your goals. If you just want to get stuff done, CS will make that easier. If you want to publish code or learn web programming, go with JavaScript. Learn javascript then coffeescript. If you already know javascript very well then it's your choice. I have stayed with javascript myself. If you're new to programming, then start with JS, because there's a lot more documentation and tutorials out there. If you've already got another programming language under your belt, then go straight to CoffeeScript. You can always look at the compiled js if you want, but you're practically never going to want to.