Palindrome Checker any advice?

I am wondering if this is a valid solution? any advice? thank you

function palindrome(str) {
let myArr = str.split("")
let palindromee =[];
for(let i=0; i < myArr.length; i++){
    palindromee.unshift(myArr[i])
}
if(palindromee.join("").toLowerCase().replace(/[\W_]/g,"") == myArr.join("").toLowerCase().replace(/[\W_]/g,"")){

  return true
}
else return false
}

console.log(palindrome("My age is 0, 0 si ega ym."));
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Challenge: Palindrome Checker

Link to the challenge:

If by valid you mean passes all the tests of the challenge, then yes it is valid.

thanks any advice on what i can work on it?

Broadly speaking, your algorithm takes the “reverse the input string into a variable, then check that the input equals that variable” approach, which is memory-intensive for very long strings.

So for example, if you have a string that is a million “a” characters followed by a “b”, you’re algorithm would have to store a second million-and-one character long string, just to immediately return false.

I guess what I mean to say is that if this were a coding interview, the interviewer would likely accept your answer as valid, but ask you “how can we reduce the memory requirements” and see what you can come up with.

So, can you think up a way to not have to save a second string to memory?