SOURCE

function checkPhone(){
    let flag = true ,a = '44 $number12&';
    if(!a && !a.includes(' ')){
        flag = false;
        console.log(1);
    }else{
        if(a.includes('&')){
            console.log(2);
            if(/&number([1-9]{1}|[1]{1}[0-2]{1})&/g.test(a)) flag = false;
        }else{
            console.log(3);
            if(!/^\d+$/.test(a)) flag = false;
        }
    }
    return flag
};

console.log(checkPhone());
console 命令行工具 X clear

                    
>
console