SOURCE

var isH = true;
 const willNewPhone   =  new Promise(
                            function(resolve,reject){
                                if(isH){
                                    var phone  = {
                                        brand:'xiaomi',
                                        color:'red'
                                    }
                                    console.log(1)
                                    resolve(phone);
                                }else{
                                    var reason  = new Error('she is no happy');
                                    reject(reason);
                                }
                            }
                        )

// willNewPhone.then((r)=>{
//     console.log(r,'++++++++++++++++')
// })
async function showOff(phone){
    console.log(2)
    console.log(phone,'hahahah')
    return new Promise((resovle,reject)=>{
        var mess = 'hi friend i hava a new' + phone.color + ' '  + phone.brand + 'phone';
        console.log(3)
        resovle(mess);
    })
}

async function askMom(){

    try{
        console.log('before asking mom');
        let phone = await willNewPhone;
        console.log(phone,'9')
        let mes = await showOff(phone);
        console.log(mes,'mmmmm');
        console.log('after asking mom');
        return new Promise((resolve,reject)=>{
            reject(4444)
        })
    }catch(err){
        console.log(err,'eeee');
    }
}

askMom().then((e)=>{
    console.log(e,'这是一个伟大的胜利')
},(err)=>{
    console.log(err,'我错了')
}).catch((err1)=>{
    console.log('catch住了',err1)
}
);

console.log('--------------------');

askMom().then((e)=>{
    console.log(e,'这是一个伟大的胜利')
}).catch((err1)=>{
    console.log('catch住了',err1)
}
);
// console.log('我是一个分割线=======')

// (async ()=>{
//     await askMom();
// })();
console 命令行工具 X clear

                    
>
console