使用嵌套for循环Javascript等待/睡眠的最佳方式?
var i = 1;
for (var a=1; a <= 6; a++) {
for (var b=1; b <= 3; b++) {
for (var c=1; c <= 3; c++) {
for (var d=1; d <= 3; d++) {
console.log(i); // It will count until 162
// Do a ajax call (I got that covered)
// Wait 5 seconds
}
}
}
}
最好的方法是什么?