title: How can I assign a value to a variable by a callback?
body: <p>I am already trying to assign a value for a variable by HTTP callback.
  But when I try to assign it, the value isn't assigned on the <code>getCurrentRate</code> scope.</p>
  <p>At the end of the html get I need to return the data object to the function that called <code>getCurrentRates</code>.</p>
  <pre><code>function getCurrentRates(baseCoin) {
      let data
      const uri = 'https://api.exchangeratesapi.io/latest?base=' + baseCoin
      https.get(uri, (res) =&gt; {
          let chuncks
          res.on('data', (chunck) =&gt; {
              chuncks += chunck
          })
          res.on('end', =&gt; {
              data = chuncks
          })
      })
  }
  </code></pre>