I want to invoke the window.setTimeot
function with my custom scope so I use the call
method, but there is something wrong.
function foo() {
this.bar = function() {
console.log("keep going");
window.setTimeout.call(this,this.bar,100);
}
this.bar();
}
new foo;
under Firefox this prints to the console only 1 line and then nothing, and under google chrome it throws a TypeError
.
What is the problem in my code?