title: Sleep function in javascript/node.js
body: <p>I am trying to create a "sleep" function where I like to wait 10 seconds before continue with next command.</p>
  
  <p>This doesn't work. No sleep is occuring. How can I put it nicely in a function like I do below "sleep(10000)" which is possible to call?</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>console.log("Hello");
  sleep(10000);
  console.log("World!");
  
  function sleep(ms) {
  
      return new Promise(resolve =&gt; setTimeout(resolve, ms));
  }</code></pre>
  </div>
  </div>
  </p>