JSFiddle - React, Tailwind, and code Playground

by AJIEKCEU

HTML

<p id="dynamic-number">0</p>

CSS

#dynamic-number {
    width: 100px;
    height: 40px;
    padding: 20px;
    background: #000;
    font: bold 35px Arial;
    color: #fff;
    text-align: center;
}

JavaScript

var currentNumber = $('#dynamic-number').text();

$({numberValue: 0}).animate({numberValue: 2000}, {
    duration: 1500,
    easing: 'linear',
    step: function() { 
        $('#dynamic-number').text(Math.ceil(this.numberValue)); 
    }
});