Thursday, 19 April 2012

About setTimeout

Never give either setTimeout or setInterval a string containing code; instead, give it an actual function reference. Otherwise, it won't work.

function foo() {
    display("Hi there");
}
setTimeout(foo, 500);

No comments:

Post a Comment