JSFiddle - React, Tailwind, and code Playground

HTML

<!--- DON'T FORGET TO OPEN YOUR JAVASCRIPT CONSOLE! -->
<!-- message # 1 fires before message # 2, much better! -->
<!-- blog.kevinchisholm.com -->

JavaScript

function getScript(callback){
   //create a script element and inject it into the page
   var script = document.createElement('script');
   script.src = 'http://sub1.kevinchisholm.com/blog/examples/sleep1.php';
   document.getElementsByTagName('head')[0].appendChild(script);
  
   //when the new script's load event fires, execute the callback
   script.onload = callback;
};

getScript(function(){
   console.log("2) the new script has been loaded"); //much better!
});