AiTeky Original Interactive Learning & Practice Intermediate
JavaScript: closures in loops, waiting in parallel and the slow dashboard
See why callbacks created in a loop can all report the last value, how waiting for requests one after another differs from waiting for them together, and speed up a dashboard that makes eight requests in a row.
JavaScript runs almost everywhere a user clicks, and two ideas cause a large share of its surprises: closures (a function remembers the variables around it, not a snapshot of their values) and asynchronous waiting (a program can start several slow jobs and wait for them together, or one at a time).
This course models both with small Python programs you can run in your browser. Python stands in for JavaScript: the code is not JavaScript, but the behaviour and the timing sums it shows are the same. Check the JavaScript documentation for exact syntax, such as let in loops and Promise.all. All numbers are made up.
- Learn lessons explain one idea at a time and let you run it.
- Industry ready lessons decide and justify, and end with interview questions.
No JavaScript experience is assumed. Basic Python helps.
- ▶ Run code in your browser. Nothing to install
- ✓ Exercises that check themselves
- 📖 Tap a word to see what it means
Locked. Sign up free
Learn
Understand each idea with everyday examples. No coding background needed.
- 01 25 min Free sample 🔒 AiTeky Pass Callbacks that all say the last value See why functions made in a loop can all see the loop variable's final value, and fix it by giving each function its own copy.
- 02 25 min 🔒 AiTeky Pass Waiting one by one or together Work out the total waiting time when slow jobs run one after another, all together, or in groups, and see why independent requests should not wait in a line.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.

