Pass functions, not strings, to setTimeout() and setInterval()

JavaScript
setInterval(doSomethingPeriodically, 1000);  
setTimeout(doSomethingAfterFiveSeconds, 5000);
Source

Also in JavaScript: