65. add comma to number
Share
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.
Related Lists
the good and bad bits of JavaScript