Categories
Determine whether a string is a palindrome.
Contributed by @itsbrunodev
function isPalindrome(str) { const normalized = str.toLowerCase().replace(/[^a-z0-9]/g, ""); return normalized === normalized.split("").reverse().join(""); }
isPalindrome("never odd or even"); // true isPalindrome("race a car"); // false