Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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//
  };
Source by sebhastian.com #
 
PREVIOUS NEXT
Tagged: #separate #thousands #comma #js
ADD COMMENT
Topic
Name
4+5 =