title: How to use for in loop and query data from firebase
body: <p>I have a query that gets all keys of users in my firebase database. Those keys er saved into an array. I would then like to loop through the array and inside the loop query for the users name. The problem is that it stops when the first name is loaded - the loop does not query through even though there are 1000 keys inside the array?</p>
  
  <pre><code>var i;
  
  for (i = 0; i &lt; emailArray.length; i++) { 
      userIDgotten = emailArray[i];
  
      console.log(userIDgotten);
  
      return firebase.database().ref('/users/' + userIDgotten).once('value').then(function(snapshotUser) {
          const name = snapshotUser.val().name;
  
          console.log("NAME: " + name);
  
          allTicketEmailsFromUsers = allTicketEmailsFromUsers + ", " + name;
  
          console.log(allTicketEmailsFromUsers);
      });
  }
  
  </code></pre>
  
  <p>I get no errors but the loop just stops after the first name is retrieved.</p>