JSFiddle - React, Tailwind, and code Playground

by kanonji

HTML

<a onclick="sleep(3);" href="http://www.example.com">run</a>

JavaScript

Date.now = (function(){
  var hasNow = !!Date.now;
  var now = Date.now;
  return function(){return hasNow ? now() : +new Date();};
})();
function sleep(sec){
    var start = Date.now();
    var until = start + sec * 1000;
    while (until > Date.now()){
    }
}