new Promise(function (resolve) { console.log('4') resolve() }).then(function () { console.log('6') }) new Promise(function (resolve) { console.log('4') resolve() }).then(function () { console.log('6') }) new Promise(function (resolve) { console.log('4') resolve() }).then(function () { console.log('6') }) new Promise(function (resolve) { console.log('4') resolve() }).then(function () { console.log('6') })
面试被问到的问题:我们都知道then会加到微任务队列,像上面这种情况,如果我有1万个new Promise,那微任务队列会不会爆满影响浏览器性能?怎么解决?
全部评论
(1) 回帖