title: access blob value outside of canvas.ToBlob() async function
body: <p>I'm working with <code>HTMLCanvas</code> element that return the blob object outside of the <code>async toBlob()</code> function. This function doesn't return an output value, so I'm trying to declare a variable outside and access it through the command.</p>
  
  <p><strong>How I can use <code>JS Promise</code> for this scenario?</strong> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>var myblob;
              canvas.toBlob(function(blob) {                         
                                myblob = blob;
                                console.log("inside " + myblob); // getting value after the console outside
                             })
   console.log( "outside " + myblob); // getting undefined   </code></pre>
  </div>
  </div>
  </p>