node38-anysc关键字

 

//只能出现再异步函数中 暂停异步函数得执行
async function fn() {
    throw '发生勒一些错误';
    return 123;
}
//console.log(fn())
fn().then(function(data) {
    console.log(data);
}).catch(function(err) {
    console.log(err);
})

 

posted @ 2022-09-02 21:49  前端导师歌谣  阅读(22)  评论(0)    收藏  举报