title: How to store a result variable inside function?
body: <p>I use <a href="https://github.com/ushelp/EasyQRCodeJS" rel="nofollow noreferrer">EasyQRCodeJS</a>, a library to generate Qr Codes.</p>
  <p>The Qr code is displayed. However, I want to save the image in base 64 to use it later. The console shows the output in base64 format, but I can't store this value.</p>
  <pre><code>var storeBase64 = '';
  
  var optionsQr = {
  
      text: 'Hello',
  
      width: 216,
  
      height: 216,
  
      correctLevel : QRCode.CorrectLevel.H,
      
      onRenderingEnd:function(options, dataURL) {
      
          console.info(dataURL); /* Ok */
          
          storeBase64 = dataURL; /* Nok */
          
      }
      
  }
  
  new QRCode(document.querySelector('#myqr'), optionsQr);
  
  console.log(storeBase64); /* Nok */
  </code></pre>