Let\'s consider this piece of JavaScript:
function Person(name) {
this.name = name;
}
Person.prototype.showName = function() {
alert(this.name);
}
If the accepted answer is just too long to read:
setTimeout(mike.showName(), 5000);
This will execute whatever mike.showName() returns after 5,000 milliseconds.
setTimeout(function(){ mike.showName(); }, 5000);
This will execute anonymous function after 5000 milliseconds that calls mike.showName() , the actual function.
Another way to achieve same effect:
setTimeout(mike.showName.bind(mike), 5000);