Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
369 views
in Technique[技术] by (71.8m points)

这三种 async 写法 区别是什么?

async function run1() {
    Promise.reject(new Error("Oops!"));
}
async function run2() {
    await Promise.reject(new Error("Oops!"));
}
async function run3() {
    return Promise.reject(new Error("Oops!"));
}

image.png
为什么run2() 结果是那样子?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...