0

Add commas to large numbers for human readability

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