JSFiddle - React, Tailwind, and code Playground

by rajeshpillai

HTML

<div id = "output">

</div>

JavaScript

function getDate() {
   // This variable stays around even after 
   // function returns
   
   var date = new Date();    
   
   // nested function
   return function () {
      return date.getMilliseconds();
   }
 }
       

     
       
var dt = getDate();

alert(dt());
alert(dt());