Palindrome exercise

Palindrome exercise
0.0 0

#1

Tell us what’s happening:
Hey guys, could you please tell me why this is not the right way to do it, the code seems logical.

Your code so far

function palindrome (str) {
   if (str === palindrome)      { 
  
  return true;
   
   } else {
     
  
  return false;
   }  

}

palindrome("eye");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:


#2

JavaScript doesn’t understand what a palindrome is, you can’t just ask it if something is a palindrome.

function lotteryNumbers() {
  return lotteryNumbers;
}

#3

You have a bit more thinking to do with your solution. Above you compare str to palindrome to see if they are equal. The problem is, palindrome is a function, so the if statement will always return false. You need to create another variable which represents the reversed alphanumeric version of str and then compare it to str.