10 XP challenge
Add the Digits Written in Text
easy
Build it yourself · 6 min
1 Learn2 Predict3 Solve
TaskYour mission
Return the sum of all digit characters in message, ignoring other characters. For example, "a24" returns 6. message has 0 to 40 ASCII characters; codes 48 through 57 represent 0 through 9.
Examples
| Input | Return |
|---|---|
message = "a24"total: 0 → 2 → 6. value: 97 → 50 → 52. The result is 6. | 6 |
message = "009"total: 0 → 9. value: 48 → 57. The result is 9. | 9 |
Your code
Write your answer inside Solution, then use return to send it back.
Ln 1, Col 1
JavaScript
Try examples runs the public examples. Check my code checks your full answer and saves your completion.