← Back to challenges

Is the Number a Repdigit

JavaScriptHardalgebrafunctional_programmingmathnumbersvalidation

Instructions

A repdigit is a positive number composed out of the same digit. Create a function that takes an integer and returns whether it's a repdigit or not.

Examples

isRepdigit(66) ➞ true

isRepdigit(0) ➞ true

isRepdigit(-11) ➞ false

Notes

  • The number 0 should return true (even though it's not a positive number).
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Sort the Unsortable