const promise = new Promise((resolve, reject) => {
    console.log(1);
    resolve('22222');
    console.log(2);
    setTimeout(() => {
      console.log(7)
    })
  }).then((res)=>{
    console.log('1111')
    console.log(res)
  });

  promise.then(() => {
    console.log(3);
    setTimeout(() => {
      console.log(6);
    })
  })
  setTimeout(() => {
    console.log(5);
  })
  console.log(4);
VM300:2 1
VM300:4 2
VM300:22 4
VM300:9 1111
VM300:10 22222
VM300:14 3
undefined
VM300:6 7
VM300:20 5
VM300:16 6

clipboard.png


小小年128
74 声望5 粉丝

坚定自己的选择,然后认真的去做每件事