ser) {return user.firstName + &quot; &quot; + user.lastName})
  alert(firstTenNames)
})

// PREFER: easy to test small functions
function getFirstTen(items) {return items.slice(0, 9)}
function getUserName(user) {return user.firstName + &quot; &quot; + user.lastName}
function getUserNames(users) {return users.map(getUserName)}

getUsers()
  .then(getFirstTen)
  .then(getUserNames)
  .then(alert)
</code></pre>
<p>In the refactored code, <code>getUsers()</code> returns a promise, and we chain three callbacks. 