JSFiddle - React, Tailwind, and code Playground

by sp182

HTML

<span id="timer"></span>

JavaScript

function countdown(count, container) {     
  var $container = $(container);
  (function step() {
    $container.html(count);               
    if (count-- > 0) {                    
      setTimeout(step, 1000);              
    }
  })();                                     
}
countdown(20, '#timer');