As far as I can tell, these two pieces of javascript behave the same way:
Option A:
function myTimeoutFunction() { doStuff();
I use setTimeout.
Apparently the difference is setTimeout calls the method once, setInterval calls it repeatdly.
Here is a good article explaining the difference: Tutorial: JavaScript timers with setTimeout and setInterval