title: Implicit response in fetch .then callback function
body: <p>I stumbled upon the following code <a href="https://www.tjvantoll.com/2015/09/13/fetch-and-errors/" rel="nofollow noreferrer">(reference)</a>:</p>
  <pre><code>function handleErrors(response) {
      if (!response.ok) {
          throw Error(response.statusText);
      }
      return response;
  }
  fetch(&quot;http://httpstat.us/500&quot;)
      .then(handleErrors)
      .then(response =&gt; console.log(&quot;ok&quot;) )
      .catch(error =&gt; console.log(error) );
  </code></pre>
  <p>I would have expected something like this:</p>
  <pre><code>then((response) =&gt; { handleErrors(response) })
  </code></pre>
  <p>How is it possible that <code>response</code> is successfully being passed to the reference of <code>handleErrors()</code>?
  Does it have something to do with promises or is this a javascript pattern that I don't know about?</p>