Here is the code I wrote on palindrome, no errors, but not working:
function palindrome(str) {
// Good luck!
x = 0;
y = 0;
for (x = 0; x == str.length; x++){
str2 = str.reverse();
for(y = 0; y == str2.length; y++){
var firstChar = str.length[x];
var lastChar = str2.length[y];
if (firstChar === lastChar){
return true;
}
}
}
}
palindrome("eye");
I will appreciate some directions.