JSFiddle - React, Tailwind, and code Playground

HTML

<script>
    var c=0
function timedCount()
{
    alert(c);
    c=c+1;
    if(c < 3){
        setTimeout("timedCount()",1000);
}
}
timedCount();
</script>