views:

133

answers:

7

I come from a C/Unix background, with a lot of experience in shell scripting, and some on Perl, elisp, etc. too. But now I'm getting into some work where I'll need to be developing interactive web-based interfaces, and I need to learn JavaScript. My problem is that all the resources I've found online for learning JavaScript seem to be targeted at an audience who's never programmed, and their authors don't seem much better. As soon as I see "validating user input to take the load off your server" as one of the great uses for JS, I want to scream and I feel like I can't trust anything else the author says. ;-)

Can anyone recommend good resources for an experienced programmer wanting to learn JS as a new language? Ideally I'd like to get started online, but dead tree recommendations would be welcome too, especially if I can preview them online.

+4  A: 

A great JavaScript book for experienced programmers is Doug Crockford's JavaScript: The Good Parts. It's short, assumes you know what you're doing, is opinionated, and is not a tutorial.

Greg Hewgill
Balance that out with the fact that Crockford comes across as (and IS, arguably) a zealot. He'll instruct you "not" to use parts of the language. Takes some with a grain of salt, as with all Zealots :) But really, +1 for a good book.
Alex Mcp
Yeah, I just previewed it on Google. As an example of what you're saying, I'd heard about type conversions using `-0`, `|0`, etc., which I *love* coming from using things like `0U+` to convert to `unsigned` in C, but I get the feeling he strongly disapproves of this sort of usage.. ;-)
R..
+1  A: 

My advice: Forget what you know about object oriented programming. Attempts to apply the inheritance paradigms from an OO language have repeatedly overcomplicated many, many chunks of JS code.

Prototyping is not Class construction. Object instantiation is not Class instantiation. "Classes" are not real.

There are ways to get what you want. You can even have something akin to privates - but they are not methods or members. They are merely locally scoped. Inheritance is often faked, but with mixed results, and universally at the expense of data hiding.

Javascript is prototyped. It is not object oriented. Keep that in mind every time you think something like, "Man, an interface here would be awesome..."

Fordi
Thankfully I come from a C background, not an OO background, so I don't have too much to forget. :-)
R..
Oh. Then may I suggest, jQuery: Novice to Ninja
Fordi
A: 

Javascript Guide from Mozilla Developer Network, a simple and yet informative guide, gives beginners a big picture of JS in a short time.

https://developer.mozilla.org/en/JavaScript/Guide

qichuan
A: 

Take a look at Eloquent JavaScript. It doesn't cover everything, but it will move you towards idiomatic JavaScript programming -- things like functional programming, closures and prototypes. (The online version comes complete with a sandbox tutorial environment.) The rest, after all, is just knowing how to use references.

Stan Rogers
+1  A: 

A good place to start for anyone wanting to learn the basics of JavaScript, which can also be used as a good reference for the API, is http://www.w3schools.com/js/.

Alasdair
Nooooooooo. Unless they've rewritten most of it since I last looked, I wouldn't recommend w3schools. Its tutorials range from passable down to outright wrong, averaging out at misguided.
Tim Down
A: 

JavaScript: the definitive guide is one of my favorite programming books: http://oreilly.com/catalog/9780596101992

Edgar Bonet