Wednesday, April 25, 2007

Clever Javascript techniques

Seven Javascript Techniques You Should Be Using Today is an interesting little article where I picked up some clever tricks I didn't know before, such as this clever little gem for using a double-bang to read and store a flag so you don't have to keep checking for DOM capability:

var w3 = !!(document.getElementById && document.createElement);

The article contains clever little blips like that and also some more design-patternsy stuff to help you constrain scope and write more efficient code. A good read.

No comments: