← Back to challenges

Find the Total Number of Digits the Given Number Has

JavaScriptHardmathnumbers

Instructions

Create a function that takes a number as an argument and returns the amount of digits it has.

Examples

findDigitAmount(123) ➞ 3

findDigitAmount(56) ➞ 2

findDigitAmount(7154) ➞ 4

findDigitAmount(61217311514) ➞ 11

findDigitAmount(0) ➞ 1

Notes

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Array From a Range of Numbers