Q1 What is the difference between Primitive and Reference types? easy โ–ธ

Primitive types store value directly on the Stack (stack memory) and are immutable. Reference types store an address/pointer on the Stack pointing to a mutable object located in the Heap memory.

Read full explanation with code examples โ†’
Q2 What is Hoisting? easy โ–ธ

Hoisting is the mechanism in JavaScript where variable and function declarations are moved to the top of their containing scope during the compilation phase, before execution begins.

Read full explanation with code examples โ†’
Q3 What is the Temporal Dead Zone (TDZ)? easy โ–ธ

The Temporal Dead Zone is the period/state between block entry and the line of declaration where variables declared with let and const cannot be accessed.

Read full explanation with code examples โ†’
Q4 What is the difference between Scope and Lexical Environment? easy โ–ธ

Scope is the actual physical boundary where a variable is accessible. Lexical Environment is the internal structure containing local variables and a reference to its parent Lexical Environment.

Read full explanation with code examples โ†’
Q5 What is the difference between == and ===? easy โ–ธ

== (Loose Equality) checks for value equality and performs implicit type coercion. === (Strict Equality) checks for both value and type without coercion.

Read full explanation with code examples โ†’
Q6 What is the difference between Null and Undefined? easy โ–ธ

undefined means a variable has been declared but not yet assigned a value. null is an intentional assignment representing "no value" or an empty object reference.

Read full explanation with code examples โ†’
Q7 What are Truthy and Falsy values? easy โ–ธ

A falsy value is a value that translates to false when evaluated in a boolean context. All other values are truthy.

Read full explanation with code examples โ†’
Q8 Explain pure vs impure functions. easy โ–ธ

A pure function always returns the exact same output for the same input and produces no side effects. An impure function can yield different outputs or modify external state.

Read full explanation with code examples โ†’
Q9 What is the difference between Shallow Copy and Deep Copy? easy โ–ธ

A shallow copy duplicates the top-level structure, keeping reference pointers to nested objects. A deep copy recursively clones every nested value and reference, decoupling them entirely.

Read full explanation with code examples โ†’
Q10 Explain Object.freeze() vs const. easy โ–ธ

const prevents reassignment of a variable reference. Object.freeze() makes the properties of an object read-only and prevents adding or removing properties.

Read full explanation with code examples โ†’
Q11 What are JavaScript Template Literals? easy โ–ธ

Template literals are string literals delimited with backticks (`), allowing multi-line strings, string interpolation, and tagged templates.

Read full explanation with code examples โ†’
Q12 Explain Arrow Functions vs Regular Functions. easy โ–ธ

Arrow functions do not have their own this context (they inherit it lexically), do not have an arguments object, and cannot be used as constructors.

Read full explanation with code examples โ†’
Q13 What is Rest and Spread Operator? easy โ–ธ

The spread operator (...) unpacks items from an array/object. The rest operator collects multiple separate arguments or items into a single array structure.

Read full explanation with code examples โ†’
Q14 What is Destructuring? easy โ–ธ

Destructuring is a clean syntax that allows unpacking properties from objects or values from arrays directly into individual variables.

Read full explanation with code examples โ†’
Q15 What is the Map data structure vs standard Objects? easy โ–ธ

Map allows keys of any data type (including objects/functions) and maintains insertion order, whereas Object keys must be Strings or Symbols.

Read full explanation with code examples โ†’
Q16 What is a Closure? medium โ–ธ

A closure is the combination of a function bundled together with references to its surrounding state (the lexical environment). It lets an inner function access the outer scope even after the outer function has finished executing.

Read full explanation with code examples โ†’
Q17 What is the Execution Context and Call Stack? medium โ–ธ

Execution Context is the environment in which code is evaluated and executed. The Call Stack is a LIFO (Last In, First Out) data structure used to manage execution contexts.

Read full explanation with code examples โ†’
Q18 Explain JavaScript Prototypes and Prototype Chain. medium โ–ธ

A prototype is an object linked to every function/object in JS where properties and methods can be inherited. The Prototype Chain is the mechanism of traversal from child prototypes upward up to Object.prototype to resolve a property.

Read full explanation with code examples โ†’
Q19 What is the this keyword? medium โ–ธ

this refers to the object currently executing the function, evaluated entirely at execution runtime based on how the function was invoked.

Read full explanation with code examples โ†’
Q20 Explain call, apply, and bind. medium โ–ธ

call invokes a function immediately, specifying this and passing arguments individually. apply does the same but accepts arguments as an array. bind returns a new function with this locked, to be called later.

Read full explanation with code examples โ†’
Q21 What is a Promise? medium โ–ธ

A Promise is an object representing the eventual completion or failure of an asynchronous operation, existing in three states: Pending, Fulfilled, or Rejected.

Read full explanation with code examples โ†’
Q22 What is Async/Await? medium โ–ธ

Async/Await is syntactic sugar built on top of Promises. It allows writing asynchronous code that looks and behaves like synchronous sequential code.

Read full explanation with code examples โ†’
Q23 What is the Event Loop? medium โ–ธ

The Event Loop is the runtime mechanism that continuously monitors the Call Stack and moves callbacks from the Callback and Microtask Queues to the stack when the stack is empty.

Read full explanation with code examples โ†’
Q24 What is Event Delegation? medium โ–ธ

Event delegation is a design pattern where you attach a single event listener to a parent element instead of individual child nodes, leveraging event bubbling.

Read full explanation with code examples โ†’
Q25 What is Debouncing? medium โ–ธ

Debouncing limits the execution of a function until a specified idle duration has elapsed since its last invocation.

Read full explanation with code examples โ†’
Q26 What is Throttling? medium โ–ธ

Throttling enforces a maximum frequency rate of execution, ensuring a function fires at most once per defined time window.

Read full explanation with code examples โ†’
Q27 Explain Event Bubbling vs Capturing. medium โ–ธ

Capturing (trickling) goes top-down from parent elements down to the target. Bubbling goes bottom-up, from the clicked child target up through parents to the global window root.

Read full explanation with code examples โ†’
Q28 What are JavaScript Classes? medium โ–ธ

Classes are syntactic sugar built over JavaScript's existing prototype-based inheritance model, providing cleaner OOP structure.

Read full explanation with code examples โ†’
Q29 What is ES6 Module System? medium โ–ธ

ES6 modules use import and export statements. They load statically, execute strictly, and help build decoupled tree-shakeable codebases.

Read full explanation with code examples โ†’
Q30 Explain Set vs Array. medium โ–ธ

A Set is an unordered collection of unique values, while an Array is an ordered collection allowing duplicate values.

Read full explanation with code examples โ†’
Q31 What is Currying? medium โ–ธ

Currying is a pattern where a function taking multiple arguments is transformed into a series of nested functions that take only one argument each.

Read full explanation with code examples โ†’
Q32 What is Memoization? medium โ–ธ

Memoization is an optimization technique that caches the return values of expensive function computations based on their input parameters.

Read full explanation with code examples โ†’
Q33 What is a Polyfill? medium โ–ธ

A polyfill is fallback JS code used to provide modern feature support to older browser clients lacking that capability.

Read full explanation with code examples โ†’
Q34 Explain Promises combinators: Promise.all vs Promise.allSettled. medium โ–ธ

Promise.all rejects immediately if any promise in the array fails. Promise.allSettled waits for all inputs to complete/fail and returns their status arrays.

Read full explanation with code examples โ†’
Q35 What is a Callback Function and Callback Hell? medium โ–ธ

A callback is a function passed as an argument to another function. Callback Hell is the term for deeply nested, unreadable callback structures that complicate control flow.

Read full explanation with code examples โ†’
Q36 Explain Generators and Iterators. hard โ–ธ

Iterators are objects defining a standard next() output sequence structure. Generators are special functions that can pause/resume execution via the yield keyword, producing iterators under the hood.

Read full explanation with code examples โ†’
Q37 What is a Memory Leak and how to detect/fix it? hard โ–ธ

A memory leak occurs when items are no longer used by the application but remain allocated in the Heap because references to them are still active.

Read full explanation with code examples โ†’
Q38 What is Garbage Collection? hard โ–ธ

Garbage Collection is an automated process in the JS engine that frees up memory occupied by objects that are no longer reachable from the root execution contexts.

Read full explanation with code examples โ†’
Q39 Explain WeakMap and WeakSet. hard โ–ธ

WeakMap and WeakSet are collections that only accept objects/symbols as keys, maintaining "weak" references to those objects so they can be collected by Garbage Collection if no other references exist.

Read full explanation with code examples โ†’
Q40 Explain Javascript Proxies. hard โ–ธ

A Proxy wraps an object, letting you intercept and customize fundamental operations like reading, writing, and modifying properties.

Read full explanation with code examples โ†’
Q41 What is Reflect API? hard โ–ธ

Reflect is a built-in object providing methods to call interceptable JavaScript operations, mirroring proxy interceptors to simplify forwarding operations.

Read full explanation with code examples โ†’
Q42 What are Web Workers? hard โ–ธ

Web Workers are browser APIs allowing JavaScript code to execute in background background threads, independent of the main user-interface thread.

Read full explanation with code examples โ†’
Q43 Explain V8 Engine Pipeline compilation. hard โ–ธ

V8 parses JavaScript into an Abstract Syntax Tree (AST), compiles it to Bytecode via the 'Ignition' interpreter, and optimizes it using 'TurboFan' into fast machine code based on hot performance loops.

Read full explanation with code examples โ†’
Q44 Write a Polyfill for Promise.all. hard โ–ธ

A custom function that returns a Promise, iterates through the array of promises, resolves each, and collects the results in a matching-index array. If any promise rejects, it rejects immediately.

Read full explanation with code examples โ†’
Q45 What is a Deep Copy polyfill? hard โ–ธ

A custom utility function that recursively copies all elements of objects and arrays, preserving depth and references while decoupling original entities.

Read full explanation with code examples โ†’
Q46 Write a Custom Promise Polyfill. hard โ–ธ

A Class representing a custom Promise implementation that captures status, value, and callbacks, handling asynchronous execution flows manually.

Read full explanation with code examples โ†’
Q47 Explain Tail Call Optimization. hard โ–ธ

Tail Call Optimization is a compiler mechanism where the engine avoids allocating a new stack frame if the last action of a function is a direct call returning another function.

Read full explanation with code examples โ†’
Q48 What is Symbol and its typical use-cases? hard โ–ธ

A Symbol is a unique and immutable primitive value, primarily used to create hidden, collision-free object property keys.

Read full explanation with code examples โ†’
Q49 What is a Shadow DOM? hard โ–ธ

A Shadow DOM is a self-contained, encapsulated DOM tree detached from the main document DOM, preventing styles and structures from leaking in or out.

Read full explanation with code examples โ†’
Q50 Advanced Interview Tricks & Edge Cases. hard โ–ธ

Tricks usually target unexpected behaviors like 0.1 + 0.2 !== 0.3 (floating-point binary representation), NaN !== NaN, and automatic semicolon insertion side-effects.

Read full explanation with code examples โ†’