title: Delay each loop iteration in node js, async
body: <p>I have the code below:</p>
  
  <pre><code>var request = require('request');
  var cheerio = require ("cheerio");
  var async= require("async");
  
  var MyLink="www.mylink.com";
  
      async.series([
  
          function(callback){
              request(Mylink, function (error, response, body) {
                  if (error) return callback(error); 
                  var $ = cheerio.load(body);
                  //Some calculations where I get NewUrl variable...
                  TheUrl=NewUrl;
                  callback();
              });
          },
          function(callback){
              for (var i = 0; i &lt;=TheUrl.length-1; i++) {
                  var url = 'www.myurl.com='+TheUrl[i];
                  request(url, function(error, resp, body) { 
                      if (error) return callback(error); 
                      var $ = cheerio.load(body);
                      //Some calculations again...
                      callback();
                  });
              };
          }
        ], function(error){
          if (error) return next(error);
      });
  </code></pre>
  
  <p>Does anyone have a suggestion about how I can delay each loop iteration in the <code>for loop</code>? Say, the code waits 10 seconds after each iteration is complete. I tried <code>setTimeout</code> but didn't manage that to work.</p>