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

Js章节 Promise实现语法错误 #192

Open
eightHundreds opened this issue Jun 3, 2019 · 0 comments
Open

Js章节 Promise实现语法错误 #192

eightHundreds opened this issue Jun 3, 2019 · 0 comments

Comments

@eightHundreds
Copy link

这个

onRejected = typeof onRejected === 'function' ? onRejected : r => throw r;

改为

onRejected = typeof onRejected === 'function' ? onRejected : r => {throw r};

而且这个Promise,跑不通这个例子

console.log('script start');

setTimeout(function() {
  console.log('setTimeout');
}, 0);

new Promise((resolve) => {
    console.log('Promise')
    resolve()
}).then(function() {
  console.log('promise1');
}).then(function() {
  console.log('promise2');
});

console.log('script end');
// script start => Promise => script end => promise1 => promise2 => setTimeout

@eightHundreds eightHundreds changed the title Promise实现语法错误 Js章节 Promise实现语法错误 Jun 3, 2019
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