求教:JS事件循环问题

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,那微任务队列会不会爆满影响浏览器性能?怎么解决?
#前端##面试题目#
全部评论
那设置一个阈值呗
点赞 回复 分享
发布于 2021-08-13 23:34

相关推荐

点赞 评论 收藏
分享
Cherrycola01:0实习 0项目 约等于啥也没有啊 哥们儿这简历认真的吗
点赞 评论 收藏
分享
评论
点赞
2
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务