Wednesday, January 18th, 2006

JavaScript idioms you need to know

Category: Dojo, JavaScript, Programming

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"])
  • The new keyword creates an object that class constructors run inside of, thereby imprinting them
  • Functions are always closures (combine w/ previous rule to create OOP)
  • The this keyword is relative to the execution context, not the declaration context
  • The prototype property is mutable

Posted by Rob Sanheim at 10:05 pm

4.1 rating from 54 votes


Comments feed TrackBack URI

I didn’t know most of this, thanks :P

Comment by Ray — January 18, 2006

JavaScript Idioms

Ajaxian has a nice article about some things you should always remember when it comes to JavaScript….

Trackback by Darkness Productions' Log — January 19, 2006

Key Points? you copy/pasted the whole thing.

Comment by Steve — January 19, 2006

You’re right – I was going to summarize but realized Alex had broken it down pretty well. Post has been updated.

Comment by Rob — January 19, 2006

This was a very clear breakdown, thanks

Comment by jeff — January 23, 2006

Leave a comment

You must be logged in to post a comment.