ar users = [{id: 1, firstName: &quot;John&quot;, lastName: &quot;Doe&quot;}]

// in that case, `users` may or may not exist depending on whether there was data in localStorage
var promise = users ? Promise.resolve(users) : getUsers()
promise
  .then(getFirstTen)
  .then(getUserNames)
  .then(alert)</code></pre>
<hr>
<h3 id="multiple-promises"><a href="#multiple-promises">Multiple promises</a></h3>
<p>In some occasions, you may need to make HTTP requests in parallel, and run code after all requests complete.