title: Data from a callback not storing on an array in js
body: <p>Following is my code -</p>
  
  <pre><code>exports.saveWeekAvailability = function(req, res){
      console.log("-- SAVE WEEK WISE DATA --");
  
      weekData = req.body;
      var resultArr = [];
      for(var i=0; i&lt; weekData.length; i++){
          Availability(weekData[i]).save(function(err, result){
              console.log("------------------------------------------");
              console.log(result);
              resultArr.push(result);
          });
      }
      console.log("-- Result Arr --");
      console.log(resultArr);
  
  };
  </code></pre>
  
  <p>But every time <code>resultArr</code> is an empty array. Let me know what I am doing wrong here.</p>