0
2
aanastasiia-tilikina
The code fragment replaces every three-digit number with a comma and every number not containing a comma with a dash.
Shortcut: spitcomma
spitcomma
0 Comments
function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); }