missingfaktor missingfaktor - 1 year ago 65
Javascript Question

What is the fastest way to learn Javascript?

What is the fastest way to learn Javascript for someone eloquent with class-based OOP & typed functional programming (Scala, Java), and having some knowledge of metaprogramming (Python, Ruby, Clojure)?

Answer Source

This is probably a subjective question. :-)

  • Play with it.
  • Try to solve real problems with it.
  • Read Crockford: online, book. Note that Crockford is intelligent and well-informed, but does sometimes blur the line between fact and his opinion in his writing. (The section on inheritance is particularly affected by this.)
  • I found JavaScript: The Definitive Guide by Flanagan useful. And apparently so have lots of others, as it's in its sixth edition now.
  • The spec is worth reading as well, if a bit hard going in places.
  • If you're interested in inheritance, the documentation for my Lineage script may be useful as it compares using the script and doing it without the script, and so goes into some of the plumbing details. (You may also find the script handy.)
  • Read questions and answers about JavaScript here at StackOverflow. Then you'll see what real problems people have, and how they get solved.
  • Closures are a very big thing in JavaScript, I'd read up on them (disclosure: that's my blog again).

Side note: If you plan to use JavaScript in a browser environment, to manipulate the DOM, etc., I'd recommend using a library to help smooth over the browser differences (mostly DOM and event related). There are plenty to choose from: jQuery, Prototype, YUI, Closure, or any of several others. But make no mistake, regardless of what library you use (or if you don't use any), it's important to understand the language.