This is the page that made doing OOP in Javascript click for me.
crockford.com
crockford.com
http://video.yahoo.com/watch/111593/1710507 (Part 1)
http://video.yahoo.com/watch/111594/1710553 (Part 2)
http://video.yahoo.com/watch/111595/1710607 (Part 3)
http://video.yahoo.com/watch/111596/1710658 (Part 4)
There are also a series on DOM, advanced stuff etc
Also, it only covers the language, since the DOM isn't a "good part". I would recommend "JavaScript: The Definitive Guide" (a.k.a. the rhino book, which the Rhino JS interpreter is named after...). I keep that one next to my desk at all times.
But in summary, "JavaScript: The Good Parts" is a good supplement to other materials (though most of what's contained in the book can be learned from his website and video lectures)
So I guess there's some truth to the rumour that Javascript is basically Scheme with C syntax. Either that, or I've drunk too much coffee this morning...
Just think about this, I know a fellow programmer (A C fan), that used to pun another one (his best friend A C++ guru) - so the former used to have this:
#define private public #define protected public
This just shows how fragile the protection of member variables in C++ is (side effect of the pre-processor).
After all, good C++ books recommend hiding data through other means (pointer that points to structure not published anywhere else (like in a library))
They do have overlapping content at times but surely helped me to understand static vs instance methods/prototype vs object.
One of the books clearly mentions how JavaScript is different than other languages. i.e. helps to understand reference/how chaining works( jQuery)
And once I read them I went back to ejohn.org and reread his posts. I can understand them better now :)
Why go through all that hoopla?
Public object attributes are iterable and otherwise manipulable by clients of the object. Upvalues are opaque to clients - you need the debugger to inspect the local stack frames. They're perfectly accessible to the closures acting as methods on your object though.
It really just comes down to your mental model of the object in question.
Call me dim, but if you can define private members which can't even be accessed by public members and only in the constructor, how are they anything except local?
I might be doing needlessly geeky nitpicking here, but "private" has a standardized meaning in pretty much all OOP languages, and calling this private just seems silly.
Edit: Reading the whole thing, it seems the butchered public and not private. Making public something different all together, and having "privileged" being the actual, usual public-modifier.
Ah well. I never liked javascript ;)
And when you say this:
"private" has a standardized meaning in pretty much all OOP languages
don't you mean "in C++ and Java"? Because Ruby's private is significantly different.
But both C#, VB.Net and pretty much any OOP language I have touched has been like that. Granted I've seen different meanings for static and protected, but I've never seen this behaviour before.
I'll simply admit my own ignorance, I guess.
One should be careful about thinking "different" means "wrong".