Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript friendly number format with commas

//ES6 Way
const numberWithCommas = (x) => {
  return x.toString().replace(/B(?=(d{3})+(?!d))/g, ',');
}
 
PREVIOUS NEXT
Tagged: #javascript #friendly #number #format #commas
ADD COMMENT
Topic
Name
2+4 =