Yesterday my friend Dave added his blog to Technorati, he sent me this e-mail:
Rank: 2,357,164 (0 links from 0 sites)
That would put me in last place. You can help.
Hopefully this blog entry will fix that. 🙂
Frozen O adds call() and apply().
The point of these methods is that when you want to callback to a method inside an object, the this variable often has unintended scope. It’s the the scope of when the callback is called (usually window) instead of the scope of the object itself. By using call() or apply() (just different syntactical ways of expressing the same thing), you can do a callback to an object.
Normally, I do this by manually constructing the closure, but this method of a generalized function is much more clever (and PHP-like syntax).
I’ll have to add that feature to my base function toolset.