Exercise 10 · Chapter: While LoopsOptional+50 XP
Digit Counter
Read a positive number and count how many digits it has.
Example 1: Input 42 → Output 2
Example 2: Input 1000 → Output 4
Hint: Keep dividing by 10 using Math.floor() until you reach 0.
Need a hint?
3 available · costs 5 XP each
javascript
Output
Run your code to see the output here.