I read here that \"self Refers to the current window or form\".
Self does not seem to refer to the current form in this case:
self is not a reserved keyword or standard type, but has become a defacto standard name when for keeping reference to an object for closures.
Here we create a closure to pass to setTimeout(). When that closure is executed, this will refer to the global object. To keep a reference to the foo object doLater was originally called on, a var named self is used. It could be anything but 'self' has meaningful semantics.
Foo.prototype.doLater = function() {
var self = this; // current object
window.setTimeout(function() { self.doSomething(); }, 1000);
}
new Foo().doLater();