JSFiddle - React, Tailwind, and code Playground
JavaScript
var logger = function(str, callback){
$("p").text($("p").text() + " " + str);
//anything can go in here, but here's a timer to demonstrate async
window.setTimeout(callback,1000);
}
$(document)
.queue(function(next){logger("Hi",next);})
.queue(function(next){logger("there,",next);})
.queue(function(next){logger("home",next);})
.queue(function(next){logger("planet!",next);});
//this runs before the above code (sync)
$("p").css("background-color","#eee");