📅  最后修改于: 2022-03-11 15:03:58.443000             🧑  作者: Mango
/*Using our reverse function for strings, we can create our palindrome
checker. Recall that our approach will be to take the string argument,
reverse it, and then compare the reversed string to the original
string.*/
function reverse(str) {
return str.split('').reverse().join('');
}
function isPalindrome(str) {
return reverse(str) === str;
}