Infinite counter with increment at two decimals

If I understand correctly, all you need to do is, instead of i++ you need to use i += 10.41. I have also changed the initial i value to zero because you want it to start from 10.41 and timer to 1000 instead of 100:

setTimeout(start, 0);

var i = 0;
var num = document.getElementById('number');

function start() {
  setInterval(increase, 1000);

function increase() {
  if (i < 100000) {
    i += 10.41;
    num.innerText = i.toFixed(2);
<span id="number"></span>

Also, I truncated it off to two decimal places using i.toFixed(2);.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top