comma separated javascript every 3 numbers code example
Example: javascript friendly number format with commas
//ES6 Way
const numberWithCommas = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
//ES6 Way
const numberWithCommas = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}