Cheat Sheets

JavaScript Interview Questions Cheat Sheet: Closures, this, Hoisting & Promises

By ArpaNeuro Team September 13, 2026
JavaScript interview cheat sheet

JavaScript interviews probe mental models: scope and closures, this binding, hoisting, the event loop, and promises. Framework trivia is secondary. Be ready to write a small debounce, explain ===, and say what let does differently from var.

This JavaScript cheat sheet is written for people searching for a fast, accurate reference: students, junior developers, and teams shipping production software. Pin it, copy the snippets, and come back when syntax slips.

Quick reference

  • Closure: A function remembers variables from the scope where it was created, even after that scope returned.
  • this: Depends on call site: method, call/apply, new, or lexical in arrows.
  • Hoisting: var and function declarations hoist. let/const are in the TDZ until initialized.
  • Event loop: Call stack runs to empty; then microtasks (promises); then macrotasks (timeouts, I/O).
  • ===: No coercion. == coerces and is a bug factory.
  • Prototype: Objects delegate via [[Prototype]]. Classes are syntax over this.
  • Truthy: 0, "", null, undefined, NaN, false are falsy. [] and {} are truthy.
  • Debounce: Delay a function until calls stop. Throttle limits rate. Know the difference.

Copy-paste examples

Closure counter and lexical this

The inner function closes over n. The arrow inside the method keeps this from the method.

function makeCounter(start = 0) {
  let n = start;
  return () => ++n;
}
const c = makeCounter();
console.log(c(), c()); // 1 2
const api = {
  token: 'abc',
  headers: function () {
    return () => ({ Authorization: this.token });
  },
};

Common mistakes

  • Confusing this in arrows vs methods and “fixing” it with random .bind(this).
  • Saying JavaScript is multi-threaded because of async.
  • Mutating arguments or prototypes in interview code without discussing the cost.
  • Cannot explain a promise vs a callback besides “async/await is newer.”

FAQ

  1. What is hoisting in one example? console.log(a) before var a = 1 prints undefined. The same with let throws. Function declarations are available before their line.
  1. How do you clone an array of objects? Shallow: [...list] or list.map. Deep: structuredClone. Mention that nested objects stay shared on shallow copy.
  1. null vs undefined? undefined means not assigned. null is an intentional empty object value. typeof null is "object" — a historic bug.

Related JavaScript cheat sheets

Build with this stack

When a cheat sheet is not enough — you need a production app, a student FYP, or a custom dashboard — ArpaNeuro builds custom web development and also sells ready-made source code. Request a quote and tell us the stack.

Browse software development services or the source code marketplace if you want a working codebase instead of starting from a blank file.

← All Articles Get a Quote →