← Back to challenges

Sum of Two Digit Numbers

JavaScriptHardalgebralogicmathnumbers

Instructions

For this challenge, you are supposed to find the sum of the digits of a two-digit number. Sounds easy, right? But for this challenge, I expect you to find the sum of the digits mathematically.

Sure, you can convert the number into a string and then manipulate it so it returns the sum of the digits, but the point of this challenge is to see if you know how to return the sum of the digits of a two-digit number mathematically.

Examples

twoDigitSum(45) ➞ 9

twoDigitSum(38) ➞ 11

twoDigitSum(67) ➞ 13

Notes

%

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Outlier Number