A very Cool Guy
A very Cool Guy

Reputation: 13

Will async.forEach() run through new elements I add to the array if its still executing?

My question is:

If I import the async module, create an array, write a async.forEach() loop for that array, and while the loop runs, I put more elements in that array for it to loop through, will it process those newly added elements?

Upvotes: 1

Views: 63

Answers (1)

Gaspa79
Gaspa79

Reputation: 5690

No. You can't modify the collection while the foreach is running, so it will not loop through your new items =(

Upvotes: 2

Related Questions