setTimeout()
:
It is a function that execute a JavaScript statement AFTER
x interval.
setTimeout(function () {
something();
}, 1000); // Execute something() 1 second later.
setInterval()
:
It is a function that execute a JavaScript statement EVERY
x interval.
setInterval(function () {
somethingElse();
}, 2000); // Execute somethingElse() every 2 seconds.
The interval unit is in millisecond
for both functions.