How to hold for loop till inside funtion not complete?


i have customer array. i want to upload one by one customer details from array.
How to hold for loop till upload methode return success or error msj. Till that i dont want to upload next customer from array? How to hold for loop ??

     for(let i=0;i<this.customerArray.length;i++){


I think this is generally a mistake, because what is ordinarily desired is actually for the uploads to either succeed or fail as a unit, in which case you don’t actually care about the ordering, and something like the forkJoin operator is pretty much exactly what you are looking for (and more efficient than what you are asking how to do).

If you insist on doing specifically what you ask about, look into the concatMap operator.