title: Trying to block-sleep in some js/node code using setTimeout
body: <p>Given the following code <em>which I run in the command line with <code>node fileName.js</code></em> it seems to run <em>all</em> the items in the loop and THEN sleep at the end ... sorta like it's all running parallel or something.</p>
  
  <p>I would like the code to block/pause during the <code>setTimeout</code> instead of just running the function AFTER the setTimeout is complete. Or, use a different method if <code>setTimeout</code> is the incorrect one, in this use case.</p>
  
  <pre><code>const removeUsers = async () =&gt; {
      const users = await db.getUsers(); // returns 32 users.
  
      // Split the users up into an array, with 2 users in each 'slot'.
      var arrays = [], size = 2;
      while (users.length &gt; 0) {
          arrays.push(users.splice(0, size));
      }
  
      // Now, for each slot, delete the 2 users then pause for 1 sec.
      arrays.forEach(a =&gt; {
          console.log(++counter;);
  
          // Delete 2x users.
          a.forEach(async u =&gt; {
              console.log('Deleting User: ' + u.id);
              await 3rdPartyApi.deleteUser({id: u.id});
          });
  
          // Now pause for a second.
          // Why? 3rd party api has a 2 hits/sec rate throttling.
          setTimeout(function () { console.log('Sleeping for 1 sec'); }, 1000);
      });
  }
  </code></pre>
  
  <p>and the logs are like this..</p>
  
  <pre><code>1.
  Deleting User: 1
  Deleting User: 2
  2.
  Deleting User: 3
  Deleting User: 4
  3.
  ...
  (sleep for 1 sec)
  (sleep for 1 sec)
  (sleep for 1 sec)
  ...
  end.
  </code></pre>
  
  <p>See how the sleep doesn't feel like it blocks.. it just fires off a sleep command which then gets handled after a sec...</p>
  
  <p>This is what I'm really after...</p>
  
  <pre><code>1.
  Deleting User: 1
  Deleting User: 2
  (sleep for 1 sec)
  2.
  Deleting User: 3
  Deleting User: 4
  (sleep for 1 sec).
  3.
  ...
  end.
  </code></pre>