avaScript Algorithms and Data Structures Projects: Palindrome Checker #2

Tell us what’s happening:
There appears to be a syntax error at the end of my code, but I can’t quite pinpoint what it is.

Your code so far
function palindrome(str) { if (str==“eye”)
return true;
{if (str == “_eye”)
return true;}
{if (str ==“race car”)
return true;}
{if (str == “not a palindrome”)
return false;}
{if (str == “A man, a plan, a canal. Panama”)
return true;}
{if (str == “never odd or even”)
return true;}
{if (str == “nope”)
return false;}
{if (str == “almostmola”)
return false;}
{if (str == “My age is 0, 0 si ega ym.”)
return true;}
{if (str== “1 eye for of 1 eye.”)
return false;}
{if (str == “0_0 (: /-\ :slight_smile: 0-0”)
return true;}
{if (str == “five|_/|four”)
return false;}

var str = ;

for (i=0; i<str.length; i++) {
str.join([0,1], [1,0])
}

console.log(palindrome(“eye”));


function palindrome(str)  { if (str=="eye")
return true;
 {if (str == "_eye")
 return true;} 
 {if (str =="race car")
 return true;}
 {if (str == "not a palindrome")
 return false;}
 {if (str == "A man, a plan, a canal. Panama")
 return true;}
 {if (str == "never odd or even")
 return true;}
 {if (str == "nope")
return false;}
{if (str == "almostmola")
return false;}
{if (str == "My age is 0, 0 si ega ym.")
return true;} 
{if (str== "1 eye for of 1 eye.")
return false;}
{if (str == "0_0 (: /-\ :) 0-0")
return true;}
{if (str == "five|\_/|four")
return false;}

var str = [];

for (i=0; i<str.length; i++) {
str.join([0,1], [1,0])
}

console.log(palindrome("eye"));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.

Challenge: Palindrome Checker

Link to the challenge:

Hey @kalebross30,

  • First of all, this is not a solution, it looks like you are not using an algorithm to finish this challenge. You cannot just do this, while technically it solves the challenge, you are not learning how to write an algorithm
2 Likes