JSFiddle - React, Tailwind, and code Playground

by shurikation

HTML

<div class="block">0</div>

CSS

.block {
  width: 100px;
  height: 100px;
  background-color: lightgreen;
  text-align: center;
  vertical-align: middle;
}

JavaScript

const $factValue = document.querySelector('.block');
    let minCounter = 0;


    while(minCounter <= 5655) {
      let ID = setInterval(() => {
        $factValue.innerText = minCounter;
        minCounter++;
      }, 500);

   /*    if(minCounter <= 5655) {
        clearInterval(ID);
      } */
    }