title: how to store the data to a var from fetch API not ajax
body: <p>How to fetch data then save inside a variable?</p>
  
  <pre><code>var store;
  
  fetch('https://api.coindesk.com/v1/bpi/historical/close.json?start=2013-09-01&amp;end=2013-09-05')
  .then(function(response) {
    return response.json();
  })
  .then(function(data) {
    store = data;
    console.log('Data is', store);
  
  })
  .catch(function(err) {
    console.log('Unable to fetch the data', err);
  });
  
  console.log(store);
  </code></pre>
  
  <p>console.log gives me undefined variable.
  Can someone describe how does it work?</p>