<spna id="span1">1</spna>
<spna id="span2">2</spna>
body {
  font-size: 40px;
  color: black;
}
function getDelay(num1,num2,delay) {
  const setDelay =  (((num1)*delay) / (num2) );
  return {delay2: setDelay, delay1:delay}
}

function setCounter(el,toNumber,delay,counter=0) {
  for(let i = 0; i < toNumber; i++) {
    setTimeout(() => {
       counter++ 
       el.textContent = counter; 
    },i*delay)
  }
} 

const num1 = 825;
const num2 = 100;
const {delay1,delay2} = getDelay(num1,num2,20)
setCounter(span1,num1, delay1)
setCounter(span2,num2, delay2)

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.