Some JavaScript Programming Patterns
“JavaScript Programming Patterns”, by Klaus Komenda, is an excellent walkthrough of several JS patterns. If you code JavaScript regularly you probably know at least some of these but will likely still find something useful in it—I particularly like the lazy function definition, a pattern originated by Peter Michaux:
var foo = function() { var t = new Date(); foo = function() { return t; }; return foo(); };
Simple, elegant, solves the problem of making sure that the heavy lifting only gets done once.
12 Oct 2009 at 04:21
High level, self modifying code? What’s next, goto statements?
12 Oct 2009 at 20:35
At least one person wants goto functionality in JavaScript…