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
Promise.resolve().then(() => { console.log(0); return Promise.resolve(4); }).then((res) => { console.log(res) }) Promise.resolve().then(() => { console.log(1); }).then(() => { console.log(2); }).then(() => { console.log(3); }).then(() => { console.log(5); }).then(() =>{ console.log(6); })
function Promise(fn){ this.status = 'pending' this.value = null this.reason = null const success=(data)=>{ if(this.status=='pending'){ this.value = data } } const error=(data)=>{ if(this.status=='pending'){ this.reason = data } } fn(success,error) } Promise.prototype.then = function(success,error){ success(this.value) error(this.reason) } let promise1 = new Promise((resolve, reject) => { resolve('data') reject('error') }) promise1.then(data => { console.log(data) },()=>{})
The text was updated successfully, but these errors were encountered:
No branches or pull requests
执行顺序
雏形
状态完善
异步完善
细节完善
The text was updated successfully, but these errors were encountered: