title: How to call a function after an asynchronous for loop of Object values finished executing
body: <p>I want to call a function after an asynchronous for loop iterating through values of an Javascript object finishes executing. I have the following code</p>
  
  <pre><code>for (course in courses) {
      var url = '...' + courses[course];
  
      request(url, (function (course) {
          return function (err, resp, body) {
              $ = cheerio.load(body);
  
              //Some code for which I use object values    
          };
      })(course));
  }
  </code></pre>