Answers for "format numbers with commas javascript 2 decimals"

36

node js format number 2 decimals with comma

function numberWithCommas(x) {
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
Posted by: Guest on June-13-2020
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 "format numbers with commas javascript 2 decimals"

Code answers related to "Javascript"

Browse Popular Code Answers by Language