JSFiddle - React, Tailwind, and code Playground

by Vengatesh rkv

HTML

<div>0</div>

JavaScript

function countTo(max, n){
    var n = n || 1;
    setTimeout(function(){
        $('div').html(n);
        if(n < max) countTo(max, n + 1);   
    }, 1000);
}

countTo(5);