这个简单的小函数抛出“意外标识符”错误,我不知道为什么。
function palindromeCheck(word) {
var reversed = word.split("").reverse().join("");
if (reversed === word) {
return "Yay, " + word + " is a palindrome!";
} else {
return "Drats, " + word + " isn't a palindrome.";
};
};
palindromeCheck("racecar");