← All Exercises

Palindrome Checker

basicjavascript~15min

Background

Palindromes appear in natural language processing, DNA sequence analysis, and coding interviews frequently.

Problem

Write a function that determines if a string reads the same forwards and backwards, ignoring spaces, punctuation, and case.

Input

A string of any characters including letters, numbers, spaces, and punctuation.

Output

A boolean indicating whether the cleaned string is a palindrome.

Sample tests

Sample 1

Input: "racecar"
Expected: true

Your solution

Learning objective

Practice string cleaning with regex and palindrome verification logic.