I have a function that counts, but I need to add a mask to this value. The final value is 3000 only I need for 3,000;
Is there a way to change the integer value to another format and still do the count within the function itself?
Follow function:
function numerosHome(id, inicialValor, valorFinal){
var inicial = inicialValor;
var location = document.getElementById(id);
var contador = setInterval(() => {
location.innerHTML = inicial;
inicial++;
var final = valorFinal +1;
if(inicial == final){
clearInterval(contador);
}
},0.5);
}
numerosHome('numeros', 2800, 3000);
#numeros{
font-size: 50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="numeros">
</div>