JSFiddle - React, Tailwind, and code Playground
by nickxbs
JavaScript
var Countdown = function(t){
var time = t;
var self=this;
this.run = function(){
console.log(time--);
if(time > 0) setTimeout(self.run, 1000);
}
}
var ticktok = new Countdown(10);
ticktok.run();