title: javascript async/await not working
body: <p>I have a specific case where I need to wait for a async calls result before
  continuing. I am using the async/await keywords, but not having any luck.
  Any help appreciated.</p>
  
  <p>This is my attempt to try getting it to work, the numbers should be in numerical order.</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-js lang-js prettyprint-override"><code>function sleep(ms) {
    return new Promise(resolve =&gt; setTimeout(resolve, ms));
  }
  
  async function demo() {
    document.writeln('2...');
    await sleep(2000);
    document.writeln('3...');
  }
  
  document.writeln('1...');
  demo();
  document.writeln('4.');</code></pre>
  </div>
  </div>
  </p>