Review the Palindrome Checker I created

Here is my code pen https://codepen.io/Bukki007/full/jOJjQaL

I didn’t look at FCC’s javascript or CSS, so if there’s any similarity, it’s purely coincidental. It took me a few hours to think about the approach I would take for the solution, and days to discover why my code wasn’t outputting the result. I read a few external blogs and discovered that I wasn’t scoping my declarations well from a random person’s codepen of a palindrome checker…

1 Like

Hi there. I found a potential bug on your palindrome tester.

Still looks pretty good though. :slight_smile:

Ah yes, I also saw that but don’t know what direction to take to fix it, particularly because my regex variable allows overlooking punctuation and underscore in the text… I don’t know if you understand what I’m trying to say

I do understand, yes. You completely strip out everything that’s not an alphanumeric or an underscore, thus leading to this situation. Understandable.

Hi, I finished this challenge today and I had another approach. For example for the regex here is mine: /[^a-z0-9]/gi.

I made a codepen so that I can share it, feel free to dive into my code, maybe it would be helpful:

Palindrome Checker from fCC (codepen.io)

I knew about your choice of regex pattern before I chose the one I used. I have already finished working on the project before sharing it. I wrote another approach that is similar to yours but I used the spread operator … You can use the spread operator to improve your code for the reversedInput variable. The spread operator lets you copy the content of a variable into another variable. Check the commented out line of code where I used the spread operator to learn how it work

Did you forget to remove the console.log in the filter function code block?

Yeah I saw it, and yeah I forgot the console.log thanks !

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