1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| let count = 0 let timer = setInterval(function(){ console.log('循环调用开始') Promise.resolve().then(function(){ console.log('start 请求') setTimeout(function(){console.log('返回请求结果')},6000) console.log('end 请求') }) console.log('循环调用结束',count) if(count == 4){ clearInterval(timer) } ++count },2000)
|