I need help with palindrome im stuck!

Tell us what’s happening:

so the code is working for some but not all i cant figure it out when they call
palindrome(“not a palindrome”)` should return false.
palindrome(“nope”)
palindrome(“almostomla”)
palindrome(“1 eye for of 1 eye.”)
palindrome(“five|_/|four”)
Your code so far


function palindrome(str) {
// Good luck!

let strRep = str.replace(/[!@#$%^&*_+-=\/|:,.]/g,'')
 let strCase =  strRep.toLowerCase()
  let split = strCase.split('')
  let rev = split.reverse()
  if(split == rev){ 
      console.log('your good')
     return true}
     else {
         console.log('no good')
         return false
     }
     
  }
  






palindrome("eye");

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 12607.82.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.123 Safari/537.36.

Challenge: Palindrome Checker

Link to the challenge:

try to console.log your strRep
did you remove eberything you wanted to remove?

plus you can’t compare two arrays like you do with split == rev
if you do [1,2,3] == [1,2,3] it results in false

I would focus on your replace pattern matching. The instructions say:

“You’ll need to remove all non-alphanumeric characters

There is a much easier pattern for finding all of these characters.

how…i been stuck ive googled this was what i found

how would you compare it, could should i turn them to strings , use like toString

You can turn an array of characters into a string by joining them together:

This should help you make an easier pattern match:

https://www.tutorialspoint.com/javascript/javascript_regexp_object.htm

so split.join(’ ‘) and rev.join(’’)

Exactly, you can join the elements of an array into a string with

const joined_str = your_array.join('');

Also, if you want to get a little more concise, keep in mind that String.split and Array.reverse return a new array and Array.join returns a new string, so this means that you can chain these functions together in one line to get what you want.