Thousand separators regex
JavaScript
function numberWithCommas(x) { // Elias Zamaria
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
document.write( numberWithCommas(1233))
function numberWithCommas(x) { // Elias Zamaria
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
document.write( numberWithCommas(1233))