老生常谈之宏任务,微任务
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
相关推荐
Magicsoftware 2019-10-19
83251242 2019-06-30
古叶峰 2020-11-16
88254251 2020-11-01
liaoxuewu 2020-05-06
Luffyying 2020-04-24
angqiuli 2020-02-16
Dansha的花果山 2019-11-19
85281643 2019-09-12
xuesong 2019-09-06
Radar 2019-07-23
西门吹雪 2019-07-01
王甲评 2019-07-01
Eric实验室 2019-07-01
xaoyege 2019-07-01
js网页特效 2019-06-30
xaoyege 2019-06-28
MarkArch 2019-06-28
bentengdehe 2012-07-25