Recursion: String Palindromes

Published by Matt in

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.

Watch a quick demo on how Edabit works.