JSFiddle - React, Tailwind, and code Playground

by wtkd

HTML

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

JavaScript

function padNum(num) {
    if (num < 10) {
        return "0" + num;   
    }
    return num;
}

       var Pointnum = Math.ceil(Math.random() * 10) + 305;	
       function countStuffUp(points,selector,duration) {//Animate count
			$({countNumber: $(selector).text()}).animate({countNumber: points}, {
  				duration: duration,
  				easing:'linear',
  				step: function() {
  					$(selector).text(padNum(parseInt(this.countNumber) ));
  				},
  				complete: function() {
   				        $(selector).text(points)
  				}
			});		
		}

		countStuffUp(Pointnum,'.pointWrap',2222);