setinterval and settimeout code example
Example 1: timeout javascript
setTimeout(function(){
}, 2000);
Example 2: timer in javascript
var timeout = setTimeout(function(){yourFunction()},10000);
var interval = setInterval(function(){yourFunction()},1000);
Example 3: setinterval vs settimeout in javascript\
var intervalID = scope.setInterval(func, [delay, arg1, arg2, ...]);
var intervalID = scope.setInterval(function[, delay]);
var intervalID = scope.setInterval(code, [delay]);
Example 4: how to do a function after a set interval js
function sayHi() {
alert('Hello');
}
setTimeout(sayHi, 1000);
setTimeout(sayHi, 1000);