Js need to call the asynchronous method in the for loop, how to ensure the implementation of the order?

Asynchronous, can not be used for cycling,
Because the for loop body is no way to pause to wait for the asynchronous call.
It should be circulating function recursively
 
This function is a recursive function calls in the function body. Recursive function must pay attention to, improper handling will enter an infinite loop. Recursive function is only used in specific circumstances, such as factorial problem
function f(num){ 
  if(num<1){ 
    return 1; 
  }else{ 
    return f (num-1) * num; 
  } 

Guess you like

Origin www.cnblogs.com/lezuw/p/12052556.html