f="#promise-chaining">Promise chaining</a></h3>
<p>Promises can be chained. Returning a value from a <code>then</code> callback makes it available as the argument to the next <code>then</code> callback. This allows refactoring code into smaller functions</p>
<pre><code class="lang-javascript">function getUsers() {return m.request(&quot;/api/v1/users&quot;)}

// AVOID: hard to test god functions
getUsers().then(function(users) {
  var firstTen = users.slice(0, 9)
  var firstTenNames = firstTen.map(function(u