Advertisement
Guest User

Untitled

a guest
May 28th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for (var i = 0; i < someLength; i++) {
  2.     asyncFunction(i);
  3.     // Need to wait here
  4. }
  5.  
  6. to.....
  7.  
  8. asyncFunction(0, loopHelper(0))
  9.  
  10. function loopHelper(i) {
  11.     if (i < someLength) {
  12.         asyncFunction(++i, loopHelper(i))
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement