[JavaScript] 纯文本查看 复制代码 function checkAccount(numStr) {
if (typeof numStr!== "string" || numStr.length!== 11 || /\D/.test(numStr)) {
return false;
}
for (let i = 0; i < numStr.length - 2; i++) {
const currentNum = parseInt(numStr);
const nextNum = parseInt(numStr[i + 1]);
const nextNextNum = parseInt(numStr[i + 2]);
if (nextNum === currentNum + 1 && nextNextNum === currentNum + 2) {
return true;
}
}
return false;
}
补充内容 (2024-12-21 21:11):
自己去除第一位字母
补充内容 (2024-12-21 21:12):
function checkAccount(numStr) {
if (typeof numStr!== "string" || numStr.length!== 11 || /\D/.test(numStr)) {
return false;
}
for (let i = 0; i < numStr.length - 2; i++) {
... |