Using Regex for formatting an integer is a little bit over engineered.
If you don't want to use native JS formatting feature, you can program it.
Algorithm:
function addCommas(nStr) {
result= ""
while (nStr.length > 3) {
tail= the last 3 digits of nStr
result= ","+ tail + result
nstr= the first (length-3) digits of nstr
}
result= nstr + result
}
I let you search exact functions as exercise.