title: Add Commas to JavaScript output
body: <p>I'm using the following script to count upward at an interval and it works perfectly. However, I'd like it to format the number with commas (56,181,995 instead of 56181995).</p>
  
  <pre><code>var START_DATE = new Date("July 27, 2010 13:30:00"); // put in the starting date here
  var INTERVAL = 1; // in seconds
  var INCREMENT = 2; // increase per tick
  var START_VALUE = 101; // initial value when it's the start date
  var count = 0;
  
  window.onload = function()
  {
  var msInterval = INTERVAL * 1000;
  var now = new Date();
  count = parseInt((now - START_DATE)/msInterval) * INCREMENT + START_VALUE;
  document.getElementById('counter').innerHTML = count;
  setInterval("count += INCREMENT; document.getElementById('counter').innerHTML = count;", msInterval);
  }
  </code></pre>
  
  <p>I thought I had found an answer here on SO but I can't get it to work:</p>
  
  <p><a href="https://stackoverflow.com/questions/2901102/how-to-print-number-with-commas-as-thousands-separators-in-javascript">How to print a number with commas as thousands separators in JavaScript</a></p>