title: change asynchronous for loop with delay to synchronous javascript
body: <p>I have async code for loop inside function that have a delay like that</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>    const timeout = ms =&gt; new Promise(res =&gt; setTimeout(res, ms))
      async function sayHai() {
        for (var i = 0; i &lt; 100; i++) {
            await timeout(1000);
            console.log("Hai");
            if ( (i%5) == 4 ) await timeout(30000);
        }
      }
      
      sayHai();</code></pre>
  </div>
  </div>
  </p>
  
  <p>i have that code to produce as below : </p>
  
  <pre><code>hai delay 1 sec
  hai delay 1 sec
  hai delay 1 sec
  hai delay 1 sec
  hai delay 1 sec
  delay 30 sec
  hai delay 1 sec
  hai delay 1 sec
  hai delay 1 sec
  hai delay 1 sec
  hai delay 1 sec
  </code></pre>
  
  <p>I want the code to be synchronous because I want to use it on the console so I need the code to be executed sequentially</p>