JSFiddle - React, Tailwind, and code Playground

by Neil Kolban

HTML

<span id="counter"></span>

JavaScript

$(function() {
    var counter = 30;
    function counterFunc() {
        
        $("#counter").text(counter);
        counter--;
        if (counter > 0) {
            setTimeout(counterFunc, 1000);
        } else {
            $("#counter").text("Done!");
        }          
    }
    counterFunc();
});