Re:Learning Advanced JavaScript
by apphacker on Saturday May 01, 2010 @01:55AM
(#1310192)
The closure section needs work. My closures never look like that. I have functions that return functions to create my closures, usually via a library via dojo.hitch, $.hitch, or goog.bind.
[ Parent
| on HN ]
window.setTimeout(function(c){return function() {
c.doSomething();
}}(this), 1000);
Mine usually look like that. Using any library to do that seems like overkill to me.Well a hitch or bind function delivers more than just ability to create quick closures. It lets you define the functionality you want in a named function, allowing for code re-use and more readable code. Also I'm obviously not using the library just for bind.