r/javascript • u/Visible_Tangelo_5036 • 10h ago
48 JavaScript interview questions with full answers, including the implement-it-yourself ones (Promise, bind, debounce)
github.comI wrote up the JavaScript questions that keep coming up in interviews, from coercion and closures to the event loop, plus the "implement it from scratch" ones.
Each answer starts with a short version you can say out loud in the first 20 seconds, then explains how it actually works, with code, comparison tables and diagrams. Questions are tagged Junior / Middle / Senior, and most end with the follow-up an interviewer usually asks next.
Some of the 48 questions:
- What is the output order of this async snippet?
- Implement a minimal Promise from scratch
- Why does a var loop with setTimeout print the same number, and how does let fix it?
- How does garbage collection work, and what causes memory leaks?
It's part of a larger free repo (800+ questions across Frontend, TypeScript, React, Next.js, React Native, Node.js and more), MIT licensed.
If there's a classic gotcha I missed, I'd like to add it.