Variables Scope & Hoisting
What is the difference between var, let, and const?
Explain the difference between Global Scope, Function Scope, and Block Scope.
What is variable shadowing?
What is the Temporal Dead Zone (TDZ), and why can't let and const variables be accessed before their declaration even though they are hoisted?
How does the JavaScript engine handle nested scopes when looking up a variable?
Why can you access a variable defined with var before its declaration, but not one defined with let?
What are the tradeoffs of using global scope, and how do ES Modules help mitigate these issues?
What is the difference between Lexical Scope and Dynamic Scope?
Why does hoisting happen in JavaScript? Explain how the engine handles function declarations vs. variable declarations during the creation phase.
Data Types & Values
What is the difference between null and undefined? When would you intentionally use one over the other?
How does the typeof operator behave with null and arrays, and why is typeof null returning 'object' a historical bug?
What are the primitive data types in JavaScript?
Why does 0.1 + 0.2 not equal 0.3 in JavaScript?
What are 'truthy' and 'falsy' values? Why is [] == false true, but [] itself is truthy?
What is NaN, and why is typeof NaN a 'number'?
What is a Symbol in JavaScript, and what are some practical use cases for it?
Type Coercion & Equality
What is type coercion, and why is === generally preferred over ==? Are there cases where == is actually useful?
Explain implicit type coercion in JavaScript.
What is the difference between Object.is() and the strict equality operator (===)?
Why does [] + [] result in an empty string?
Functions & This Binding
What is a higher-order function? Provide examples from the built-in Array.prototype.
What is the difference between an arrow function and a regular function regarding this?
What is the difference between a function declaration and a function expression?
What is the difference between map, forEach, filter, and reduce?
How is the value of this determined in different contexts (e.g., arrow functions, regular functions, methods, and the new keyword)?
Explain 'Function Currying' and why you might use it.
What is the difference between .call(), .apply(), and .bind()? When would you use one over the others?
What is an IIFE (Immediately Invoked Function Expression), and why was it commonly used?
Objects Prototypes & Inheritance
What is the difference between __proto__ and prototype?
What is prototypal inheritance, and how does it differ from classical inheritance found in languages like Java or C++?
Explain the prototype chain. What happens when you try to access a property that doesn't exist on an object?
What happens under the hood when you call a function with the new keyword?
Why are ES6 classes called syntactic sugar?
How does the instanceof operator work, and how does it relate to the prototype chain?
When would you use Object.create(null) instead of a standard object literal?
Asynchronous Javascript
What are the three states of a Promise?
Why would you use async/await over raw Promises? Are there any performance trade-offs?
What is the difference between Promise.all, Promise.allSettled, Promise.any, and Promise.race, and when would you choose one over the others?
How does the fetch API handle HTTP error status codes like 404 or 500?
When would you use Promise.allSettled instead of Promise.all?
What are the different states of a Promise, and can a Promise be 'cancelled' in native JavaScript?
Why does await block the execution of a function but not the entire main thread?
How does error handling work with try/catch/finally, and how do you create custom error types?
Why does a Promise resolve before a setTimeout(0)?
What happens if a Promise is never resolved or rejected, and how does the engine handle this hanging state?
Dom & Events
What does preventDefault() do, and how does it differ from stopPropagation()?
What is 'Event Delegation' and why is it considered a performance optimization?
Explain Event Bubbling and Event Capturing. How do you stop an event from propagating?
What is the difference between stopPropagation() and stopImmediatePropagation()?
What is the difference between an attribute and a property in the DOM?
What is requestAnimationFrame, and how does it differ from setTimeout for animations?
What is the difference between the DOM, the Virtual DOM, and the Shadow DOM?
Closures & Functional Programming
How can you use closures to create private variables?
Explain the difference between passing by value and passing by reference in JavaScript.
Explain closures and provide a real-world example of when you would use one.
What is a 'Pure Function' and why are they preferred in many modern architectures?
What is 'Memoization' and how does it relate to closures?
What does Object.freeze() do, and how can you achieve immutability in JavaScript?
How does JSON.stringify handle things like functions, undefined, and circular references, and what do the replacer and toJSON do?
What is structuredClone and when would you use it over JSON.parse(JSON.stringify())?
Operators & Syntax
What is the Nullish Coalescing operator (??) and how does it differ from the Logical OR operator?
What is 'Optional Chaining' (?.) and where does it short-circuit?
What is the difference between the spread operator and rest parameters, and how are they used?
What is destructuring assignment, and how does it work for objects and arrays?
What is the difference between for...in and for...of loops?
Language Features & Techniques
Explain the difference between shallow copy and deep copy, and when is structuredClone() preferred over JSON.parse(JSON.stringify())?
What is the difference between Map/Set and WeakMap/WeakSet, and why would you use a weak version for memory management?
What are the trade-offs of using a Map versus a plain Object for storing key-value pairs?
What are the trade-offs between Throttling and Debouncing? When would you use one over the other for a search input vs. a window resize event?
Explain the concept of 'Tree Shaking' and how static import/export statements enable it.
What are Generator functions, and how do they differ from standard functions in terms of execution control?
What is 'Strict Mode' (use strict) and what specific errors does it prevent?
What are private class fields (using the # prefix), and how do they differ from the convention of using underscores?
What is Object.groupBy(), and how does it differ conceptually from using reduce for grouping?
Explain the difference between ES Modules (import/export) and CommonJS (require/module.exports). Why did the industry move toward ESM?
Explain the difference between Short Polling, Long Polling, and WebSockets. When is each appropriate?
What is the iterable and iterator protocol in JavaScript?
Browser Rendering & Storage
Compare localStorage, sessionStorage, and Cookies. What are the security and storage-limit trade-offs of each?
Explain the role of an AbortController and how it is used to cancel a fetch request or remove multiple event listeners.
What is the difference between a Web Worker and a Service Worker, and when would you use one over the other?
Explain the Critical Rendering Path. How does JavaScript execution affect the parsing of HTML and CSS?
How does the Event Loop decide when to perform a UI re-render in the browser?
What is the difference between a reflow and a repaint? Which one is more expensive, and how can you minimize them?
Event Loop & Concurrency
Explain the JavaScript event loop and the relationship between the call stack, Web APIs, the callback queue, and the microtask queue.
Why does setTimeout with 0 milliseconds not necessarily execute in 0 milliseconds?
How does the JavaScript event loop handle a single thread while performing non-blocking I/O?
Explain the difference between microtasks and macrotasks. Which has priority, and why does it matter for UI responsiveness?
What happens to the Call Stack when an await keyword is encountered in an async function?
What happens if a microtask recursively schedules another microtask, and what is starvation?
Engine Internals & Memory
Explain the new Set methods in ES2025 (union, intersection, difference) and when you'd use them.
What is a 'Memory Leak' in JavaScript, and how can a closure or an event listener cause one?
How does JavaScript's garbage collection (mark-and-sweep) work?
What are deoptimizations in a JS engine, and what kind of code patterns usually trigger them?
What is a JavaScript Proxy, and what are some practical use cases for it (e.g., validation, logging)?
What are the new features in ES2025/ES2026 that you find most impactful?
What is Just-In-Time (JIT) compilation in engines like V8?