Write a function that checks if a given string (case insensitive) is a palindrome.
My code:
function isPalindrome(x) {
let normal = x.toString().toLowerCase();
let reverse = normal.split('').reverse().join('').toLowerCase();
if (normal === reverse) {
return true;
} else {
return false;
}
}
const isPalindrome = (x) => {
return x.split("").reverse().join("").toLowerCase() === x.toLowerCase() ? true : false
}