Wednesday, January 18th, 2006
JavaScript idioms you need to know
<>p>Alex Russell (of Dojo fame) has a nice post on fundamental principles of JavaScript you need to really grok the language. Once you understand them, you’ll be well on your way to creating real JavaScript instead of just doing the copy/paste/tweak routine. The key points Alex’s points are:- Everything is an Object – even functions
- Every object is always mutable
- The dot operator is equivalent to de-referencing by hash (e.g.,
foo.bar === foo["bar"]) - The
newkeyword creates an object that class constructors run inside of, thereby imprinting them - Functions are always closures (combine w/ previous rule to create OOP)
- The
thiskeyword is relative to the execution context, not the declaration context - The
prototypeproperty is mutable
Related Content:











I didn’t know most of this, thanks :P
JavaScript Idioms
Ajaxian has a nice article about some things you should always remember when it comes to JavaScript….
Key Points? you copy/pasted the whole thing.
You’re right – I was going to summarize but realized Alex had broken it down pretty well. Post has been updated.
This was a very clear breakdown, thanks