JSFiddle - React, Tailwind, and code Playground

JavaScript

let str = "Cigar? Toss it in a can. It is so tragic"

const is_p = string => {
    const cleaned = string.replace(/\W/g, "").toLowerCase();

    return (
        cleaned ===
        cleaned
            .split("")
            .reverse()
            .join("")
    );
}

console.log(is_p(str))