title: How to access the JSON object outside the Fetch API response?
body: <p>I am currently having a problem accessing <code>emoji_map</code> outside of the <code>then</code> scope and I don't know how to do it.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>if (req) {
      fetch(req).then(function(response) {
          return response.json();
      }).then(function(response) {
      /* start to observe */
      emoji_map = response.emoji_map;
      console.log(emoji_map);
      });
  
  }
  </code></pre>
  
  <p>When I do console.log(emoji_map); outside if loop I cannot access the response assigned. Can anyone help?</p>