Facebook Pixel

A JavaScript Interview Cheat Sheet of Must-Know Topics

A quick cheat sheet of the JavaScript topics you must know for interviews, with concise explanations.

A JavaScript Interview Cheat Sheet of Must-Know Topics

A quick cheat sheet of the JavaScript topics you must know for interviews, with concise explanations.

let, const, var

let and const are block-scoped. var is function-scoped and hoisted. Const cannot be reassigned. Use let and const, avoid var.

Hoisting and TDZ

Declarations are hoisted. var is initialized as undefined. let and const are hoisted but in the temporal dead zone, where accessing them before declaration throws.

Closures

Functions that remember their lexical scope. Enable data privacy, callbacks, and patterns like once and memoize.

this

Determined by how a function is called. Arrow functions inherit this from their surrounding scope. Bind, call, and apply set this explicitly.

Event Loop

Single-threaded JS handles async via the call stack, microtask queue (promises), and macrotask queue (setTimeout, events). Microtasks run before macrotasks.

Promises

Three states: pending, fulfilled, rejected. Once settled, cannot change. Use then/catch or async/await. Promise.all rejects on any failure, allSettled never rejects.

Async/Await

Syntactic sugar over promises. await pauses until settled. async marks a function as returning a promise. Errors handled with try/catch.

Prototypes

Each object has a prototype. Property lookup goes up the prototype chain until found or reaching null. Classes are syntactic sugar over prototypes.

Equality

=== compares without coercion. == compares with coercion. Always use === to avoid unexpected type conversions.

DOM

Event delegation uses one listener on a parent via bubbling. Bubbling: target to root. Capturing: root to target. Use these for efficient DOM handling.

The Takeaway

Know this JS cheat sheet cold: let/const/var, hoisting and TDZ, closures, this, the event loop, promises, async/await, prototypes, equality, and DOM events. Each is a common interview topic.

let/const/var, hoisting and the temporal dead zone, closures, this, the event loop, promises, async/await, prototypes, equality (=== vs ==), and DOM events including event delegation and bubbling. Each is common in JS interviews.

Single-threaded JS handles async via the call stack, the microtask queue (promises), and the macrotask queue (setTimeout, events). Microtasks run before macrotasks, which is why promise callbacks run before setTimeout callbacks set at the same time.

Functions that remember their lexical scope, even after the outer function has returned. They enable data privacy, callbacks, and patterns like once and memoize.

=== compares without coercion, requiring same type and value. == compares with coercion, converting types before comparing. Always use === to avoid unexpected type conversions.

Using one listener on a parent to handle events from many children, via event bubbling and the event target. It is efficient for large or dynamic lists and a common DOM interview topic.

Ready to master React completely?

Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.