JSFiddle - React, Tailwind, and code Playground

by evildonald

JavaScript

timer = function() {
    start = new Date();
    return function() { return new Date() - start; };
};
 
t = timer();
alert("This takes some time...");
time = t();
alert("Total time was " + time + " milliseconds.");