We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setTimeout(()=>{console.log(1)},0) async function timeout (){ const a = await new Promise((res, rej) => { setTimeout(() => {console.log(2); res(3)}, 0) }) console.log(a); } await timeout(); console.log(4);
The text was updated successfully, but these errors were encountered:
setTimeout(()=>{ console.log(0) }, 0); new Promise((resolve, reject) => { console.log(1); resolve() }).then(()=>{ console.log(2); new Promise((resolve, reject) => { console.log(3); resolve(); }).then(() => { console.log(4) }).then(() => { console.log(5) }) }).then(() => { console.log(6) })
new Promise((resolve, reject) => { console.log(7); resolve(); }).then(() => { console.log(8); })
Sorry, something went wrong.
https://jakearchibald.com/2015/tasks-microtasks-queues-and-schedules/
Promise.prototype.then 方法,当未传入参数,或者参数非函数时,会被忽略掉且不会报错,当Promise状态发生改变的时候 then方法会将最后一次状态作为then的状态被执行
No branches or pull requests
setTimeout(()=>{console.log(1)},0)
async function timeout (){
const a = await new Promise((res, rej) => {
setTimeout(() => {console.log(2); res(3)}, 0)
})
console.log(a);
}
await timeout();
console.log(4);
The text was updated successfully, but these errors were encountered: