Advertisement
zebadeee

Add commas to number

Oct 30th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. num = value; function addCommas(x) {
  2.     return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  3. }
  4.  
  5. addCommas(num)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement