# 回文数
function isLoop(num) {
for (let left = 0, right = num.length - 1; left < right; left++, right--) {
if (num[left] !== num[right]) return false;
}
return true;
}
console.log(isLoop("12321"));
console.log(isLoop("123211"));
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
← 合并数组 图的深度广度优先遍历 →