Calculate the sum of digits of a number.
123
6
Time: 2s · Memory: 256 MB
Convert the number to a string and iterate through the digits.
> Run your code to see console output.