function palindrome(str) {
let a = 10, c=0;
let str1=str.toLowerCase()
let length = str1.length - 1
let len = (str1.length / 2+1)
for (let i = 0; i <= len; i++) {
let c1 = str1.charCodeAt(i);
let b = length - i + c
let c2 = str1.charCodeAt(b);
if (!(c1 > 47 && c1 < 58) &&
!(c1 > 96 && c1 < 123)) {
break;
}
else if (!(c2 > 47 && c2 < 58) &&
!(c2 > 96 && c2 < 123)) {
c++;
continue;
}
if (str1[i] != str1[b]) {
a = 20;
break;
}
}
if (a == 10)
return true;
else
return false;
}
palindrome("eye");
This is my code for the palindrome checker project. Code works fine locally for all cases but is failing in one case when i run it in freecodecamp site. Can anyone help me out of this?