I've got this script that increments a fixed number.
var START_DATE = new Date("January 1, 2014 00:00:00");
var INTERVAL = 10;
var INCREMENT = 1;
var START_VALUE = 12345678;
var count = 0;
$(document).ready(function() {
var msInterval = INTERVAL * 1000;
var now = new Date();
count = parseInt((now - START_DATE)/msInterval) * INCREMENT + START_VALUE;
document.getElementById('counter').innerHTML = count;
window.setInterval( function(){
count += INCREMENT;
document.getElementById('counter').innerHTML = count;
}, msInterval);
});
And on my HTML I've got the following:
<div id="counter"></div>
Every 10 seconds my initial number increases by one unit. So it comes out something like 12345678, which isn't easy to read. I'd like it to have some periods every three units. Something like 12.345.678.
What do I need to add to the script so that the final number comes out that way?
Thank you.