0

Add commas to large numbers for human readability

Function JavaScript 1 revisions 378 2 years ago 2 years ago
function numberWithCommas(x) {
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}