Palindrome checker issue

Tell us what’s happening:
Describe your issue in detail here.
I dont understand why the text case “1 eye for of 1 eye.” should return false . I guess it is a palindrome . I passed all the other text cases except this . Can someone help me where I was wrong.

  **Your code so far**

function palindrome(str) {
var final_string = "";
var final_before = "";
var a = []
var alpha = "abcdefghijklmnopqrstuvwxyz"
var alpha_cap = alpha.toUpperCase();
var f = []
for(var i in alpha){
  a.push(alpha[i]);
}
 for(var i in alpha_cap){
  a.push(alpha_cap[i]);
}
for(var j in str){
  if(a.includes(str[j])){
    f.push(str[j])
  }
}
var z = f.length;
for(var i=z-1;i>=0;i--){
  final_string += f[i]
}
for(var i=0;i<z;i++){
  final_before += f[i]
}
final_string = final_string.toLowerCase()
final_before = final_before.toLowerCase()

if(final_before==final_string){

return true;
}
else{

return false;
}
}
palindrome("1 eye for of 1 eye.");
  **Your browser information:**

Challenge: Palindrome Checker

Link to the challenge:

The number 1 should be included in the check for equality.

A nonalphanumeric character is a character, or symbol, that appears on a keyboard that is not a number or a letter, including punctuation and mathematical symbols.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.