function recurTest(j, length){ setTimeout(function(){ console.log("第"+(j+1)+"次循环"); if(++j < length){ recurTest(j, length); } }, Math.random() * 3000); } function testPromise(){ recurTest(0,10) }
完美解决循环回调,有依赖关系的处理
function recurTest(j, length){ setTimeout(function(){ console.log("第"+(j+1)+"次循环"); if(++j < length){ recurTest(j, length); } }, Math.random() * 3000); } function testPromise(){ recurTest(0,10) }
完美解决循环回调,有依赖关系的处理