📜  javascript 回文检查 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:59.907000             🧑  作者: Mango

代码示例3
function palindrome(str) {
 var splitted = str.split("");
 var reversed = splitted.reverse("");
 var joined = reversed.join("");
 return joined.toLowerCase().replace(/[^0-9a-z]/gi, '') == str.toLowerCase().replace(/[^0-9a-z]/gi, '')
}