How to Solve the Grouped by Commas Challenge in Javascript
The challenge
Finish the solution so that it takes an input n
(integer) and returns a string that is the decimal representation of the number grouped by commas after every 3 digits.
Assume: 0 <= n < 2147483647
Examples:
The solution in Javascript
Option 1:
Option 2:
Option 3:
Test cases to validate our solution
|
|