Mridul Tilwaliya’s Post

40 #JavaScript Interview Questions 1. What is the difference between var, let, and const? 2. How does JavaScript handle hoisting? 3. What is the Temporal Dead Zone (TDZ)? 4. Explain closures with a real-life example (e.g., private counter or module pattern). 5. What is the difference between == and ===? (Bonus: When might loose equality be useful?) 6. What are all the JavaScript data types (primitives + objects)? 7. What is NaN and how do you reliably check for it? 8. What is the event loop in JavaScript? Describe the call stack, Web APIs, task queues. 9. Explain microtasks vs macrotasks with examples. 10. What is the difference between synchronous and asynchronous code? 11. What are promises and why were they introduced (callback hell killer)? 12. Difference between async/await and .then() chaining? Pros/cons? 13. What happens if a promise is neither resolved nor rejected (pending forever)? 14. What is callback hell and how do modern patterns avoid it? 15. What is the purpose of setTimeout and setInterval? How accurate are they? 16. How does 'this' work in different contexts (global, object, constructor, strict mode)? 17. What is the difference between arrow functions and regular functions (this, arguments, constructor)? 18. What is function currying? Write a simple curry example. 19. What are higher-order functions? Give 3 array method examples. 20. Explain call(), apply(), and bind() with use cases. 21. What is prototypal inheritance? 22. Difference between Object.freeze() and Object.seal()? 23. What is the prototype chain? How does lookup work? 24. What are shallow copy vs deep copy? When does it matter? 25. How do you clone an object in JavaScript (shallow & deep methods)? 26. What is destructuring (object & array)? Nested example? 27. What is the spread operator (...) and rest parameter? Differences? 28. What are template literals and tagged templates? 29. What is optional chaining (?.) and when to use it? 30. What is nullish coalescing (??) vs logical OR (||)? 31. Difference between map(), filter(), and reduce()? When to choose each? 32. What is debouncing vs throttling? Implement a debounce function. 33. What is memoization? Why & how to implement it? 34. What is event delegation? Why is it better than attaching listeners to each element? 35. Difference between for...in and for...of? When to use each? 36. What is strict mode ('use strict')? What bugs does it prevent? 37. Difference between undefined and null? (typeof surprises?) 38. What are IIFEs (Immediately Invoked Function Expressions)? Modern alternatives? 39. What is a pure function? Why prefer them? 40. What are side effects in JavaScript? Examples? #JavaScript #JSInterview #Frontend #WebDevelopment #CodingInterview

To view or add a comment, sign in

Explore content categories