← Back to challenges

Recursion: String Palindromes

JavaScriptHardrecursionstringsvalidation

Instructions

Write a function that recursively determines if a string is a palindrome.

Examples

isPalindrome("abcba") ➞ true

isPalindrome("b") ➞ true

isPalindrome("") ➞ true

isPalindrome("ad") ➞ false

Notes

An empty string counts as a palindrome.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Bug: Regular Expression