[javascript] Palindrome check in Javascript

function palindrome(str) {
// Good luck!
//convert the string into lowerCase.
 str = str.toLowerCase();
//this line remove all non=alphanumeric characters.
 strAlphaNum = str.replace(/[^a-z0-9]/g,"");
//this line create an array of the strAlphaNum string.
 strArray = strAlphaNum.split("");
//this line reverse the array
 strReversed = strArray.reverse();
//this line join the reversed array to make a string whithout space.
 strRevJoin = strReversed.join("");
//this condition check if the given string is a palindrome.
 if (strAlphaNum === strRevJoin){
 return true;}    
 else {return false;}
 }