How to count all the palindromes in a string using recursion?
问题 I have a recursive function that checks if a string is a palindrome, but my assignment asks me to count the number of palindromes in a string (for example kayak has 2). I'm really confused about how I can implement a recursive function that counts the number of palindromes. Here's my current code: function isPalindrome(string) { if (string.length <= 1) { return true; } let [ firstLetter ] = string; let lastLetter = string[string.length - 1]; if (firstLetter === lastLetter) { let