Answers for "js string number with commas"

36

number with commas js

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

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//
  };
Posted by: Guest on January-26-2022

Code answers related to "js string number with commas"

Code answers related to "Javascript"

Browse Popular Code Answers by Language