title: Thousands separator for integers in javascript
body: <p>I have the following 
  How do I convert OrderID to thousands separator i.e., 100,000?? 
  I'm doing it this way but it's not working:</p>
  
  <pre><code>var thousandseparator = [
  "QRDER_QTY", "EXEC_QTY", "AVG_PX", "NOTIONAL_USD", "LIMIT_PX", "LIQ_CONSUMPTION"
  ];
  
  for(var i = 0; i &lt; json.length; i++) {
      var obj = json[i];
      for(key in obj) {
          if(thousandseparator.indexOf(key) != -1) {
          obj[key] = Number(obj[key].toString().toLocaleString());
        }
  
      }
  }
  </code></pre>
  
  <p>Also, I'm converting each element to integer like this:</p>
  
  <pre><code>var jsondata = document.getElementById("jsonArray").value;
      var json = JSON.parse(jsondata);
  
  var parsedData = json.map(function(obj) {
      return Object.keys(obj).reduce(function(memo, key) {
          var value = obj[key];
          //console.log(value);
          memo[key] = isNumeric(value) ? Number(value) : value;
          //localStorage.setItem("storeditem", value);
  
          return memo;
      }, {})
  });
  </code></pre>
  
  <p>But on doing so, the decimals like 2.40 are converted to 2.4. How do I make it 2.40 only??</p>