is single character palindrome? code example
Example 1: check if palindrome
function isPalindrome(str) {
str = str.toLowerCase();
return str === str.split("").reverse().join("");
}
Example 2: palindrome
function isPalindrome(text) {
return [...text].reverse().join('') === text;
}
isPalindrome = text => {
return [...text].reverse().join('') === text;
}
isPalindrome = text => [...text].reverse().join('') === text;