How to print a number with commas as thousands separators in JavaScript
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
How to print a number with commas as thousands separators in JavaScript
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
how to separate thousands with comma in js
const totalBalance = (x, y) => {
let total = parseInt(x.replace(/,/g, "")) + parseInt(y.replace(/,/g, ""));
return total.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
//Output structure will be like:23,236//
};
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us