Sum digits of an integer

FCC link

Write a function that takes a string as a parameter. This string represents a number that can be in any base (less than 37) and return the sum of its digits.

  • 110 sums to 1
  • 123410 sums to 10
  • fe16 sums to 29
  • f0e16 sums to 29

Test

{{test}}

Console output