JavaScript
Closures, Event Loop, Promises, Garbage Collection, this binding, Prototypes, and Event Delegation.
11 In-Depth TopicsClosures
A closure is a function bundled together with the lexical scope it was created in, so it keeps access to those outer variables even after the outer function has returned.
Event Loop & Asynchronous JavaScript
The Event Loop is the single-threaded coordinator that constantly monitors the Call Stack and transfers pending callbacks from the Microtask Queue and Task Queue once the stack is empty.
Promises, Async/Await & Race Conditions
A Promise is an object representing the eventual completion (or failure) of an asynchronous operation and its resulting value, preventing callback hell via chainable state transitions (pending -> fulfilled/rejected).
Debounce & Throttle Internals
Debounce delays execution until a burst of events pauses for N milliseconds; Throttle guarantees execution at most once every N milliseconds during continuous event streams.
Object Mutation & Deep Clone Internals
Deep Cloning creates an exact, independent copy of an object and all its nested references, avoiding shared object mutations while handling complex types like Date, RegExp, Map, Set, and circular references.
JavaScript & React Memory Leaks
A memory leak occurs when memory allocated by an application is no longer needed by the program logic but is retained by unintended references, preventing Garbage Collection (GC) from reclaiming it.
Scope, Hoisting & Temporal Dead Zone
Hoisting is JavaScript's compilation phase behavior where variable and function declarations are registered into memory within their lexical scope before any line of code executes.
this, Execution Context, call, apply, and bind
In JavaScript, 'this' refers to the object that is executing the current function. Its value is determined at runtime based on invocation context, unless explicitly bound or within an arrow function.
Prototypes, Prototype Chain, and Class Inheritance
JavaScript uses prototypal inheritance where objects hold an internal [[Prototype]] reference to another object. Property lookups traverse up this prototype chain until found or null is reached.
Event Bubbling, Capturing, and Event Delegation
Event Delegation is a pattern where a single event listener is attached to a parent element to handle events on its current and future children, leveraging DOM event propagation (bubbling).
Building React-like Class Components from Scratch (ES5 Prototypes & Mounting)
Building React-like components in ES5 involves creating a base `Component` constructor function with `setState` and `render` on `Component.prototype`, implementing prototype inheritance via `Object.create`, and wiring a micro-reconciler to mount and re-render the DOM tree.