Problem with the Palindrome challenge

Finished writing the code for this challenge.I can’t seem to see my mistake however.It works on all the input but two,which are

palindrome(“A man, a plan, a canal. Panama”)

  and

palindrome(“My age is 0, 0 si ega ym.”)

It returns a green tick for all the other tests.

first off you don’t need the complex if statement. You can simply do:

return newStr === splittedString;

your problem is the regex. You are replacing things that are not a number or letter OR period/comma. Hence
"My age is 0, 0 si ega ym." has a period at the end and is not a palindrome. Just take out the punctuation, and it will work.

function palindrome(str) {
var newStr = str.toLowerCase().replace(/[^a-z0-9]+/g,"");
var splitedString = newStr.split("").reverse().join("");
// Good luck!
return newStr === splitedString;

}

This code now works thanks a lot!!!

palindrome(“eye”);