Check for Palindromes Help (just a clue please!)

Check for Palindromes Help (just a clue please!)
0

#1

Can someone let me know if I’m on the right track? Or if I need to completely scrap the for loop and try something else. This works for comparing the first and last letters but won’t compare anything after that. Thanks!

function palindrome(str) {
var lowered=str.toLowerCase();
var noSpecial= lowered.replace(/[^a-zA-Z0-9]/g, ‘’);
var myArray=noSpecial.split("");
var i=0;
for (i=0; i<myArray.length/2; i++){
if (myArray[i]===myArray[myArray.length-1-i]){continue;}
else {return false;}
}
}

palindrome(“eye”);


#2

Hint: If your script makes it all the way through the for loop without it returning false, you still need to return something. In other words, is it a palindrome if it makes it all the way through the for loop? Once you figure this last thing, you will complete this challenge.


#3

Thank you so much! I got it!