title: An array returns the correct values but when called later returns all values as 'undefined'
body: <p>I have a bunch a JSON files and my code reads the files and stores them into and array, When console logging the array i get the correct values and after but rendering a page, I console logged the array again the all of its values were 'undefined'.  </p>
  
  <pre><code>let place = [];
  let key, count = 0;
  
  function Search(req, res){
  
    let fileName = getFileName(req, res);
    let emirate = req.body.emirate;
    let type = req.body.type;
  
    if(emirate == undefined || type == undefined){
      req.flash('error', 'Please fill in the form');
      res.redirect('/')
  
    }else{
      fs.readFile(`./places_files/${emirate}/${fileName}.json`, function(err, data){
        if(err){
          console.log(err);
        }else{
          let rawData = JSON.parse(data);
          for(key in rawData.places){
            place[count] = rawData.places[count]
            count++;
          }
          console.log(place) // returns all of the values
          res.render('results', {
             places: place
          });
          console.log(place); // returns all values as undefined 
        }
      });
     }
   }
  </code></pre>