web interface hacking. People are transitioning from those who consume
frameworks to discover graphical libraries and unit testing systems.
Unlock the power of prototypal inheritance early on. If you're using a
anonymous functions to elegantly plug the gaps in the language -- using
functions as namespaces and other interesting tricks.
If you're already familiar with C, Java, Ruby, Python and so on you
One fun little surprise is block scopes -- or the lack of them. Blocks
don't introduce scope, there's only function-level scope. If you start a
if and there are
var delcarations inside it, those variables will be visible
to the entire function.
Another little surprise is the behaviour of the equality operator:
== doesn't always behave as you'd expect:
js> '' == '0' false js> 0 == '' true
If this has got you worried, I recommend:
open source code:
- John Resig has a great blog and exciting projects like jQuery, Processing.js and Sizzle.js
- Sam Stephenson wrote Prototype and a bunch of other cool stuff like Sprockets
- Ryan Dahl who wrote node.js has some interesting projects
- TJ Holowaychuk has written a tonne of interesting projects, like ext.js, express and jspec
A good way to learn techniques this way is to look out for common
patterns, then figure out how they work when you need them. For example,
if you like the way JSpec's API has its own DSL and you'd like to write
Douglas Crockford's work.
David Flanagan, the author of
Guide is another authority on