65. add comma to number

JavaScript
Is this helpful ?

medium  - accepted / - tried

Given a number, please create a function to add commas as thousand separators.

addComma(1) // '1'
addComma(1000) // '1,000'
addComma(-12345678) // '-12,345,678'
addComma(12345678.12345) // '12,345,678.12345'

Input are all valid numbers.

Let's try to solve this problem within 10 mintues.

Discuss(25)