Answers for "settimeout nodejs"

3

settimeout node js

setTimeout(function () {
    console.log("5 secondes"); 
}, 5000); 
console.log("now");
Posted by: Guest on April-03-2020
4

setinterval nodejs

setInterval(function () {
    console.log("Every 5 secondes"); 
}, 5000); 
console.log("now");
Posted by: Guest on April-03-2020
-2

javascript this in settimeout

function func() {
  this.var = 5;
  
  this.changeVar = function() {
    setTimeout(() => { //Don't use function, use arrow function so 'this' refers to 'func' and not window
      this.var = 10;
    }, 1000);
  }
}

var a = new func();
a.changeVar();
Posted by: Guest on May-20-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language