Skip to main content
🧩 Algorithms & Problem Solving

Palindrome Check

A palindrome reads the same both ways ("racecar"). Real inputs have mixed case and punctuation, so normalize first: lowercase and strip non-alphanumerics.

"A man, a plan...".toLowerCase().replace(/[^a-z0-9]/g, "");

Your task

Write isPalindrome(str) that returns true if the string is a palindrome, ignoring case, spaces, and punctuation. An empty string counts as true.

⚑ 35 XP
solution.jsRuns in your browser
Loading editor…
Tests3 to pass
"racecar" β†’ true
"hello" β†’ false
ignores case & punctuation

Run your code to check these.