JSFiddle - React, Tailwind, and code Playground

HTML

<div>one</div>
<div>two</div>
<div>three</div>

JavaScript

function sleep(ms)
{
    return new Promise(resolve => setTimeout(resolve, ms));
}

$(document).ready(function()
{
	(async () =>
  {
  	console.log("This method works, but its length to write");
  	var elements = $("div");
    
    for(var index = 0; index < elements.length; index++)
    {
    	var el = $(elements.eq(index));
      
    	console.log("The content is: " + el.text());
      
      await sleep(1000);
		}
    
    console.log("This method doesn't work, but its easier to write");
    $("div").each(async (index, el) =>
    {
    	console.log("The content is: " + $(el).text());
      
      // doesn't wait
      await sleep(1000);
    });
  })();
});