Palindrome Challenge q?

I am wondering is step 1 necessary if you can ignore case with -i with .match?
so step 2 would actually read → .match(/[a-z0-9]/gi);

This is the walkthrough code:

function palindrome(str) {
    const alphanumericOnly = str
        // 1) Lowercase the input
        // 2) Strip out non-alphanumeric characters
    // 3) return string === reversedString
    return alphanumericOnly.join('') ===

function palindrome(str) {
return true;

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

Challenge: Palindrome Checker

Link to the challenge:

If you console.log() your result, you could test this yourself :wink:
But the answer will be: “Yes, it is” because while the .match() can ignore case, it will still keep case intact. Meaning the following comparison will still compare and thus fail if the same letters appear in different case.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.