settimeout function es6 code example
Example 1: settimeout es6
var timerid = setTimeout(() => {
console.log('hi :D ');
}, 1000);
clearTimeout(timerid);
myVar = setTimeout("javascript function", milliseconds);
clearTimeout(id_of_settimeout);
/ Rnadco.ir /
Example 2: settimeout arrow function javascript
doWork(callback) {
setTimeout(() => callback(this.name), 15);
}
Example 3: settimeout function es6
if (timerid) {
clearTimeout(timerid);
}
timerid = setTimeout(() => {
this.reqMaq(obj['fkmaqid'])
}, 2000);