title: forEach loop with async code?
body: <p>I am making a function call 3 times with different arguments:</p>
  
  <pre><code>this.getContributorProperties('followers_url', 'contributorFollowers');
  this.getContributorProperties('gists_url', 'contributorGists');
  this.getContributorProperties('repos_url', 'contributorRepositories');
  </code></pre>
  
  <p>This function looks like that:</p>
  
  <pre><code>async getContributorProperties(propertyUrl, propertyName) {
      const contributors = await this.addLinkToContributor();
      for (let i = 0; i &lt; 10; i += 1) {
        axios.get(`${contributors[i][propertyUrl]}?per_page=100&amp;${API_KEY}`).then((res) =&gt; {
          contributors[i][propertyName] = res.data.length;
        });
      }
      return contributors;
  }
  </code></pre>
  
  <p>It loops through an array of contributors (object type) and makes an API call for each one of them. I need to make 3 API calls for each one of them hence the three calls at the beginning.
  In order to DRY up my code I wanted to make a forEach loop like so:</p>
  
  <pre><code>[
        ['followers_url', 'contributorFollowers'],
        ['gists_url', 'contributorGists'],
        ['repos_url', 'contributorRepositories'],
      ].forEach(this.getContributorProperties);
  </code></pre>
  
  <p>forEach loop is in <code>componentDidMount()</code>
  When I make 3 calls it works ok. But when I do forEach I get an error:</p>
  
  <pre><code>Uncaught (in promise) TypeError: Cannot read property 'addLinkToContributor' of undefined
  </code></pre>
  
  <p>How do I make it work?</p>
  
  <p>BONUS: How do I then assign those key-value pairs to each object?</p>