Gist c38b5428350be0929bb330f44e6c9d82
✓ Published0🌍 Public
Aamazingandyyy
Last edited Nov 17, 2017
Created on Nov 17, 2017
This example contrasts two JavaScript approaches to looping over asynchronous tasks. It shows that an `async` loop with `await` inside a `for` loop executes each iteration sequentially, waiting for a five-second `setTimeout` before logging the next index, while a plain `Promise`-based loop fires all five calls concurrently, each logging after a two-second delay. The code uses native `async`/`await` and `Promise` constructors, with `setTimeout` simulating delay, and logs indices to the console. No external libraries or data sources are involved, highlighting raw JavaScript concurrency behavior.
AI-generated description