title: JS Fetch API access return value
body: <p>This is how I access the result from a fetch call:</p>
  
  <pre><code>let data;
  
  fetch(someUri)
      .then((response) =&gt; response.json())
      .then(_data =&gt; {
          data = _data;
      })
      .catch(error =&gt; {
          console.error(error);
      });
  </code></pre>
  
  <p>Is it also possible to access the result from the fetch function itself, like this:</p>
  
  <pre><code>let data = fetch(someUri)
      .then((response) =&gt; response.json())
      .then(data =&gt; {
          // do some stuff
          return data;
      })
      .catch(error =&gt; {
          return error;
      });
  </code></pre>
  
  <p>So <code>data</code> will be either the JSON data or the error. I see in my Chrome console that the result is in the variable, but I don't know how to access it because it's wrapped with other information.</p>