Skip to content
New issue

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

Promise.resolve的实现和浏览器表现不一致 #5

Open
sl1673495 opened this issue Mar 30, 2020 · 0 comments
Open

Promise.resolve的实现和浏览器表现不一致 #5

sl1673495 opened this issue Mar 30, 2020 · 0 comments

Comments

@sl1673495
Copy link

Promise.resolve = function(value) {
    var promise = new Promise(function(resolve, reject) {
      resolvePromise(promise, value, resolve, reject)
    })
    return promise
 }

这是代码中的实现。

和浏览器中的执行无法对应

var a = Promise.resolve(1)
var b = Promise.resolve(a)
a === b // true
sl1673495 added a commit to sl1673495/Promise3 that referenced this issue Mar 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant