timer in node js code example
Example 1: settimeout node js
setTimeout(function () {
console.log("5 secondes");
}, 5000);
console.log("now");
Example 2: setinterval nodejs
setInterval(function () {
console.log("Every 5 secondes");
}, 5000);
console.log("now");
Example 3: timer in javascript
//single event i.e. alarm, time in milliseconds
var timeout = setTimeout(function(){yourFunction()},10000);
//repeated events, gap in milliseconds
var interval = setInterval(function(){yourFunction()},1000);