JSFiddle - React, Tailwind, and code Playground
HTML
<head>
</head>
<body>
<div id="counter">0</div>
<a href="#">Click</a>
</body>
JavaScript
$(function() {
var current = $('#counter').text();
var endvalue = 50;
function timeoutVersion() {
if (current === endvalue) {return false;} else {
current++;
$('#counter').text(current);
}
setTimeout(timeoutVersion, 50);
}
$('a').click(function() {
timeoutVersion();
})
})