I\'m reading Javascript Web Applications, from O\'Reilly. At various points in the book, the author uses something along the following:
instance.init.apply(insta
Using apply() in that example insures that 'this' === instance, instead of DOMWindow if instance.init() is executed from another function/expression.
var x = function(){ debugger; },
y = function(){ x.apply(x, arguments); },
z = function() { x(arguments); };
y("abc", true, []); // this === x
z("abc", true, []); // this === DOMWindow
It's simply specifying context.