← Back to challenges

Recursion: Integer Digits Count

JavaScriptHardrecursionmath

Instructions

Create a function that recursively counts the integer's number of digits.

Examples

count(318) ➞ 3

count(-92563) ➞ 5

count(4666) ➞ 4

count(-314890) ➞ 6

count(654321) ➞ 6

count(638476) ➞ 6

Notes

  • You are expected to solve this challenge via recursion.
  • An iterative version of this challenge can be found via this link.
  • A collection of challenges in recursion can be found via this link.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.