title: Getting data using d3.json() is not working, while it works using JS async await.. Why?
body: <p>I am trying to get some data from url to work with in d3.js. I can't seam to get the data using <code>d3.json(url, callback)</code>. While it works fine when I use (ES8) <code>async await</code> function.</p>
  
  <p>Can someone help me understand why? What am I doing wrong? Thanks!</p>
  
  <p><strong>d3.json() example:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>d3.json("https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/GDP-data.json", json =&gt; {
    
       const data = json.data; // array of dates and values
       const lowestVal = d3.min(data, d =&gt; d[1]);
       const highestVal = d3.max(data, d =&gt; d[1]);
       
       console.log(lowestVal);
       console.log(highestVal);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Async await example:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(async function() {
    try {
      const response = await fetch("https://raw.githubusercontent.com/FreeCodeCamp/ProjectReferenceData/master/GDP-data.json");
      if (response.ok) {
        const jsonResponse = await response.json();
        
        const data = jsonResponse.data; // array of dates and values
        const lowestVal = d3.min(data, d =&gt; d[1]);
        const highestVal = d3.max(data, d =&gt; d[1]);
        
        console.log(lowestVal);
        console.log(highestVal);
      }
    } catch(error) {
      console.log(error);
    }
  })();</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I understand there should be some CORS issue here also. But I am working on CodePen for the moment. So CORS is not a problem here.</p>
  
  <p>Many thanks for any insights.</p>