 This can be accomplished by <code>Promise.all</code></p>
<pre><code class="language-javascript">Promise.all([
  searchUsers(&quot;John&quot;),
  searchUsers(&quot;Mary&quot;),
])
.then(function(data) {
  // data[0] is an array of users whose names are John
  // data[1] is an array of users whose names are Mary

  // the returned value is equivalent to [
  //   getUserNames(data[0]),
  //   getUserNames(data[1]),
  // ]
  return data.map(getUserNames)
})
.then(alert)</code></pre>
<p>In the example above, th