← Back to challenges

How Many Digits?

JavaScriptHardalgorithmsmathconditionsloops

Instructions

Given an integer n. Your task is to find how many digits this integer contains without using String or Array methods!

Examples

sumDigits(100) ➞ 3

sumDigits(1000) ➞ 4

sumDigits(1) ➞ 1

Notes

N/A

javascript
Loading editor…
⌘ ↡ to run
Walks through the solution with reasoning and edge cases.
Next: Find the Average of the Letters πŸ“Š β†’