title: How to extract data from a resolved promise javascript?
body: <p>I'm trying to extract data from NewsAPI - the result from the API I'm getting is a resolved promise and I can't figure out how to access the object inside of it.</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>///////////////////SAMPLE CODE
  
  let raps;
  
  var url = 'https://newsapi.org/v2/top-headlines?' +
            'category=sports&amp;' +
            'q=raptors&amp;' +
            'apiKey=xxxxxxxxxxxxxxxxxxxxxxxxxx';
  var req = new Request(url);
  fetch(req)
      .then(function(response) {
          raps = response.json();
          return raps;
      });
  
  
   function data () {
       if(raps == undefined) {
           console.log("Data is being parsed")
       } else {
           console.log(raps);
           clearInterval(loadData);
           generateData(raps);
       }
   }
  
   const loadData = setInterval(data, 1000);
  
   function generateData(raps) {
       let newData = raps.articles;
       console.log(newData);
   }
  
  /////////////////END OF SAMPLE CODE
  
  What I'm getting back is:
  
  
  Promise {&lt;resolved&gt;: {…}}
  __proto__: Promise
  [[PromiseStatus]]: "resolved"
  [[PromiseValue]]: Object
  articles: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
  status: "ok"
  totalResults: 26</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm trying to access the articles array.</p>