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
假如有这么一段代码
new Promise(resolve => { resolve(1); Promise.resolve().then(() => console.log(2)); Promise.resolve().then(() => console.log(5)); }).then(t => console.log(t));
请问为什么输出结果是2,5,1呢? resolve(1) 之后,不应该是优先注册了外部 .then 的回调吗? 还是说内部的 Promise 是同步执行的?
resolve(1)
.then
Promise
Originally posted by @ftv031 in #19 (comment)
resolve 只是把改变了Promise的status 然后把1存起来了 并不是直接执行then , 而是then之后看到状态是resolved才直接执行
The text was updated successfully, but these errors were encountered:
promise需要将里面的代码都执行完才会到自己的then
resolve(1); Promise.resolve().then(() => console.log(2)); Promise.resolve().then(() => console.log(5));
Sorry, something went wrong.
No branches or pull requests
假如有这么一段代码
请问为什么输出结果是2,5,1呢?
resolve(1)
之后,不应该是优先注册了外部.then
的回调吗?还是说内部的
Promise
是同步执行的?Originally posted by @ftv031 in #19 (comment)
resolve 只是把改变了Promise的status 然后把1存起来了 并不是直接执行then , 而是then之后看到状态是resolved才直接执行
The text was updated successfully, but these errors were encountered: