javascript判断给定字符串是否是回文

//判断给定字符串是否是回文
    function isPalindrome(word) {
      return word==word.split("").reverse()join("");
    }
    
    alert(isPalindrome("hello"));
 
    alert(isPalindrome("racecar"));

 

posted @ 2016-12-07 15:38  流星泪  阅读(1734)  评论(0编辑  收藏  举报