JavaScript Interview Questions (50+ Questions)
Level 1 - Foundation (Basic JS, 14 Qs)
1. What is the difference between var, let, and const?
2. What is hoisting in JavaScript?
3. What is the difference between == and ===?
4. What are data types in JS?
5. What are truthy and falsy values?
6. What is a closure?
7. What is a callback function?
8. What is the scope in JS?
9. What is lexical scope?
10. What is the 'this' keyword?
11. Difference between function declaration and function expression
12. What is the event loop in JS?
13. What are arrow functions and how are they different?
14. What is IIFE (Immediately Invoked Function Expression)?
Level 2 - Core Concepts (Intermediate JS, 18 Qs)
1. What are promises?
2. What is async/await and how is it better than promises?
3. What is the difference between call, apply, and bind?
4. What are higher-order functions?
5. What is currying in JS?
6. What is the difference between shallow copy and deep copy?
7. What is the spread operator and rest operator?
8. What are template literals?
9. Explain event bubbling and capturing
10. What is the difference between synchronous and asynchronous code?
11. What is debouncing and throttling?
12. What are Set and Map in JS?
13. What is the use of Object.freeze() and Object.seal()?
14. What is the difference between null and undefined?
15. How does the typeof operator work?
16. What is optional chaining (?.) and nullish coalescing (??)?
17. What is the difference between for...in and for...of?
18. How do you handle errors in JS?
Level 3 - Advanced & Browser (12 Qs)
1. How does JavaScript handle memory management?
2. What is garbage collection in JS?
3. What is a memory leak?
4. Explain the call stack, Web APIs, callback queue and event loop
5. What is a microtask queue vs macrotask queue?
6. What is a service worker?
7. What are modules in JavaScript (ES6)?
8. How does JS handle concurrency?
9. What is CORS and how do you handle it?
10. What is the difference between localStorage, sessionStorage, and cookies?
11. What is the DOMContentLoaded event?
12. How do you polyfill a feature in JS?
Level 4 - Machine Coding / Problem Solving (6 Qs)
1. Implement a deep clone function
2. Build your own bind method
3. Implement a debounce function
4. Flatten a deeply nested array
5. Write a custom Promise.all
6. Design a function that retries API calls with exponential backoff