JSFiddle - React, Tailwind, and code Playground

HTML

<!--- DON'T FORGET TO OPEN YOUR JAVASCRIPT CONSOLE! -->
<!-- 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/sleep2.php';
   document.getElementsByTagName('head')[0].appendChild(script);
  
  //when the new script's load event fires, execute the callback
   script.onload = callback;
};

getScript(function(){
   //window.getSecretWord now exists
   var secret = getSecretWord();

   //output the secret
   console.log("The secret word is: " + secret);
});