Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node js while loop with settimeout

var myFunc01 = function() {
  var i = 0;
  while (i < 100) {
    (function(i) {
      setTimeout(function() {
        console.log("hello")
      }, 1000 * i)
    })(i++)
  }
};

myFunc01();
Source by newbedev.com #
 
PREVIOUS NEXT
Tagged: #node #js #loop #settimeout
ADD COMMENT
Topic
Name
2+5 =