title: How to make javascript fetch synchronous?
body: <p>I'm using fetch to get data json from an api. Works fine but I have to use it repeatedly for various calls, thus it needs to be synchronous or else I need some way to update the interface when the fetch completes for each component.</p>
  <pre><code>function fetchOHLC(yUrl){
      fetch(yUrl)
      .then(response =&gt; response.json())
      .then(function(response) {
                  alert(JSON.stringify(response.query));
  
              var t = response.created;
              var o = response.open;
              var h = response.high;
              var l = response.low;
              var c = response.close;
          
          return {t,o,h,l,c};
      
      })
      .catch(function(error) {
          console.log(error);
      });    
  }
  
  var fetchData = fetchOHLC(yUrl);
  alert(fetchData); // empty ?
  </code></pre>
  <p>Is there any other way to achieve it other than using fetch? (I don't want to use jquery preferrably).</p>
  <p>Thanks</p>
  <p><strong>Edit</strong></p>
  <p>The question is about fetch-api, not ajax, not jquery, so please stop marking it as duplicate of those questions without reading it properly.</p>