1foo()
2setInterval(foo, delay)
3
4// OR
5
6function foo() {
7 // ...
8 setTimeout(foo, delay)
9}
10foo()
1function sayHi() {
2 alert('Hello');
3}
4//Do a function at a set interval continuously
5setTimeout(sayHi, 1000);
6//Do a function once after a set interval
7setTimeout(sayHi, 1000);