题解 | #回文字符串#
回文字符串
https://www.nowcoder.com/practice/84424799af474ba093b06c29a1f12dfb
const _isPalindrome = (string) => {
// 字符串拆分为数组,反转后在转为字符串比较
return string.split("").reverse().join("") === string;
};
回文字符串
https://www.nowcoder.com/practice/84424799af474ba093b06c29a1f12dfb
const _isPalindrome = (string) => {
// 字符串拆分为数组,反转后在转为字符串比较
return string.split("").reverse().join("") === string;
};
相关推荐