March 3rd, 2024
What's missing in this code?
function isPalindrome(str)
// Hint: remove lowercase, uppercase, and numbers (in that order)
const cleanStr = str.replace(/[^
]/g, "").toLowerCase();
return cleanStr === cleanStr.split(
).
.join("");
}
// Example usage
isPalindrome("racecar"); // true
isPalindrome("hello"); // false
isPalindrome("level"); // true
Type or select from these options