I have built a function that formats a number using commas, similar to what the toLocaleString method does. To achieve that, I used a regular expression and rec
toLocaleString