title: How do I get data from pending resolved promise without async/await?
body: <p>I have abstraction:</p>
  
  <pre><code>function fetchDataFromAPI() {
    const url = `https://api...`
    return fetch(url).then(response =&gt; response.json())
  }
  </code></pre>
  
  <p>I want to use it in my other piece of code like:</p>
  
  <pre><code>if(something){
    const data = fetchDataFromAPI()
    return data 
  }
  </code></pre>
  
  <p>if I <code>console.log</code> data what I get is resolved pending promise</p>
  
  <pre><code>Promise {&lt;pending&gt;}
    __proto__: Promise
    [[PromiseStatus]]: "resolved"
    [[PromiseValue]]: Object
  </code></pre>
  
  <p>How do I get that Object in <code>data</code> instead of Promise?</p>