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

tasks, microtasks #22

Open
zhangyanan0525 opened this issue Oct 2, 2018 · 0 comments
Open

tasks, microtasks #22

zhangyanan0525 opened this issue Oct 2, 2018 · 0 comments

Comments

@zhangyanan0525
Copy link
Owner

zhangyanan0525 commented Oct 2, 2018

task, microtasks

先总结一下

image

这里有个外国人的文章写的不孬

竟然还找到了一篇翻译

但是事实上这篇更通俗易懂

还有文章1,文章2

要是哪篇都不想看,做个题也能想明白

题目在这里的啦

console.log('1');

setTimeout(function() {
    console.log('2');
    new Promise(function(resolve) {
        console.log('4');
        resolve();
    }).then(function() {
        console.log('5')
    })
})
new Promise(function(resolve) {
    console.log('7');
    resolve();
}).then(function() {
    console.log('8')
})

setTimeout(function() {
    console.log('9');
    new Promise(function(resolve) {
        console.log('11');
        resolve();
    }).then(function() {
        console.log('12')
    })
})
new Promise(resolve=>{
    resolve(1)
    Promise.resolve().then(()=>{
      console.log(2)
    })
  }).then(t=>console.log(t))
  console.log(3)
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