title: Not able to pass a value to a then-fetch function
body: <p>I am trying to pass a value "x" Inside fetch to the then function but in vain</p>
  
  <pre><code>    var fetch = require("node-fetch");
  
  getHubspotData('https://api.hubapi.com/deals/v1/deal/paged?hapikey=demo&amp;properties=dealname&amp;properties=dealstage&amp;properties=closedate&amp;properties=dealtype&amp;properties=type&amp;properties=hubspot_owner_id&amp;properties=amount&amp;properties=notes_last_updated&amp;includeAssociations=true');
  
  function getHubspotData(url) {
      console.log("URL: " + url);
      fetch(url)
          .then((resp) =&gt; resp.json()) // Transform the data into json
          .then(function () {
              var x = 2;
          }).then(function (x) {
              console.log(x);
          })
  
  }
  </code></pre>
  
  <p>I get undefined when I try to console.log the value of x</p>
  
  <p>Any help on this matter would be greatly appreciated!</p>