Hi,
I need to code a number count for the number below.
What's not working:
1) Doesn't display as the exact number. Only as 53 000 000
2) How can I end the number with a "+" sign?
3) When website is published, the coding doesn't display.
Here's my code below:
let startNum1 = 1000000; let endNum1 = 53000000; const duration1 = 10; // 1000 milliseconds $w.onReady(function () { setInterval(()=> { countUp1(); }, duration1); }); function countUp1(){ if (startNum1 <= endNum1 ){ $w('#text10').text = startNum1.toLocaleString().toString(); startNum1 += 500000; } }
–––––––––––––
Can anyone help please ?
I tried your code and it works fine. However, it counts really fast and finishes in almost no time at all.
A couple issues and questions:
You have a count interval of 10 milliseconds which is very fast. If you want to count slower, change the interval (as an example) to 500 milliseconds (half a second).
You are adding 500,000 each time you count. Is that what you want to count by? Or do you want to increment by 1 each time?