Answers for "thousand comma separator in javascript"

36

number with commas js

function numberWithCommas(x) {
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
Posted by: Guest on June-13-2020
9

js format number thousands separator

function numberWithCommas(x) {
    return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
Posted by: Guest on January-05-2021
2

commas for thousands js

var number = 3500;

console.log(new Intl.NumberFormat().format(number));
// → '3,500' if in US English locale
Posted by: Guest on May-07-2021
0

javascript format number with commas

let n = 234234234;
let str = n.toLocaleString("en-US");
console.log(str); // "234,234,234"
Posted by: Guest on March-01-2022

Code answers related to "thousand comma separator in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language