JSFiddle - React, Tailwind, and code Playground

JavaScript

var Countdown = function(t){
    var time = t;
    this.run = function(){
        console.log(time--);
        if(time > 0) setTimeout(this.run.bind(this), 1000);
    }
}

var ticktok = new Countdown(10);
ticktok.run();