Commas in counter

when i run the code i get the correct number, but it does not display any commas between the numbers.
the output im getting is 4300000000, but i want 4.300.000.000 :smiley: please help me
my javascript looks like this

var Cont={val:0,} , NewVal = 4300000000 ;,5,{val:NewVal,roundProps:"val",onUpdate:function(){  


<div id="smart-device-counter"> 0 </div>

It’s a number, numbers cannot be represented with commas/periods/underscores in JS. Even in programming languages that do support that notation, it’s just to make it easier to read large numbers in the code, they aren’t there in the output: 4300000000 is an actual number, 4.300.000.000 is not, that’s just a culture-specific (ie mainly just Mainland European) convention for writing out large numbers in text.

You’ll need to manually turn it into a string then write a function to add commas (for example, take the number -> make it into a string -> working backwards, split every three digits -> join back together with your seperator inbetween each group).

1 Like