JSFiddle - React, Tailwind, and code Playground
HTML
<body>
Online visitors <span id="counter"></span>
</body>
JavaScript
$("#counter").text(Math.floor((Math.random() * 500) + 100));
setInterval(function() {
var counter = $("#counter");
var curVal = parseInt(counter.text());
var diff = Math.random() * 5;
var sign = Math.random();
if (sign > 0.45) {
counter.text(Math.floor(curVal + diff));
} else {
counter.text(Math.floor(curVal - diff));
}
}, 2000);