(str)
| 7 | */ |
| 8 | |
| 9 | const palindrome = (str) => { |
| 10 | if (typeof str !== 'string') { |
| 11 | throw new TypeError('Invalid Input') |
| 12 | } |
| 13 | |
| 14 | if (str.length <= 1) { |
| 15 | return true |
| 16 | } |
| 17 | |
| 18 | if (str[0] !== str[str.length - 1]) { |
| 19 | return false |
| 20 | } else { |
| 21 | return palindrome(str.slice(1, str.length - 1)) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | export { palindrome } |
no outgoing calls
no test coverage detected