JavaScript Interview Questions
JavaScript interview questions
JavaScript interview questions for junior, mid and senior developers, with what a strong answer covers, a practical task and a scorecard.
Short answer: Good JavaScript interviews test the event loop, closures, async code with promises, scope and this, and modern ES features. Senior candidates should also discuss performance, memory leaks, module design and testing. Pair 6 to 8 questions with a short coding task.
How to Use These Questions
Pick 6 to 8 questions that match the role level. Ask follow-ups on real trade-offs, not definitions. Score each answer from 1 to 4 against the “strong answer” column.
JavaScript Interview Questions by Level
Junior
| Question | What a strong answer covers |
|---|---|
| What is the difference between let, const and var? | Block vs function scope, hoisting, the temporal dead zone, reassignment rules. |
| Explain == vs ===. | Type coercion with ==, strict comparison with ===, and why === is the safe default. |
| What is a closure? | A function that keeps access to its outer scope; a practical use such as private state. |
Mid-level
| Question | What a strong answer covers |
|---|---|
| How does the event loop work? | Call stack, task queue, microtask queue, and why promises run before setTimeout. |
| Promises vs async/await: when do you use each? | Same model underneath; error handling with try/catch; running tasks in parallel with Promise.all. |
| How is this decided in a function? | Call site rules, arrow functions, bind, call and apply, and class methods. |
Senior
| Question | What a strong answer covers |
|---|---|
| How do you find and fix a memory leak in a browser app? | DevTools heap snapshots, detached DOM nodes, forgotten listeners and timers. |
| How would you structure a large JavaScript codebase? | Modules, clear boundaries, TypeScript, linting, tests and build tooling choices. |
| How do you keep a page fast? | Bundle size, code splitting, debouncing, avoiding layout thrash, Core Web Vitals. |
A Practical JavaScript Task
Give the candidate 45 minutes to build a debounced search box that calls a mock API, shows loading and error states, and cancels stale requests. Review readability, async handling and edge cases.
Red Flags in a JavaScript Interview
- Cannot explain why a promise callback runs before setTimeout
- Mutates shared objects without noticing side effects
- No idea how to debug in browser DevTools
- Uses var everywhere with no reason
- Has never written a test
Interview Scorecard
| Area | 1 β weak | 4 β strong |
|---|---|---|
| Language basics | Confuses scope and coercion | Explains scope, closures and this clearly |
| Async code | Callback soup, no error handling | Clean async/await with errors and cancellation |
| Code quality | Long functions, unclear names | Small, testable functions |
| Performance | Never measured anything | Uses profiling data to decide |
Hire Vetted JavaScript Talent Without Running Every Interview
Staffenza runs five vetting steps for you: CV and portfolio review, technical assessment, live technical interview, English check and references. Remote engineers from India or Pakistan cost USD 225 a month on top of salary. In the UAE and Saudi Arabia, direct hire costs 15β20% of the first-year package, with a 3-month replacement guarantee.
The Bottom Line
Test the event loop, closures and async code first, then a short real task. Seniors should show they can keep large codebases fast and maintainable.
Related: hire JavaScript developers, TypeScript interview questions, React interview questions, all interview question guides.
Ready to hire? Email [email protected] or use our contact page.
JavaScript Interview FAQs
How many JavaScript questions should I ask?
Ask 6 to 8 questions that match the level, then a short practical task.
Should I test TypeScript too?
Yes, if your codebase uses it. TypeScript is now standard in large front-end codebases.
Is a take-home task better than live coding?
A short live task shows reasoning; a take-home shows code quality. Use one, kept under two hours.
What matters most for senior JavaScript roles?
Architecture, performance, testing and the ability to guide other developers.


















