Interview-ready reference

JavaScript, at a glance.

The essential concepts, patterns, and gotchas to review before a front-end technical interview.

10high-signal topics
from scope to async

Variables & scope

01

Prefer const; use let when reassignment is required. Avoid var in modern code.

const name = 'Ada';
let score = 0;
{ let local = true; }
Lexical scope is determined by where code is written.

Functions

02

Declarations are fully hoisted. Arrow functions have lexical this and cannot be constructors.

function add(a, b) { return a + b; }
const double = n => n * 2;

Objects & arrays

03

Use destructuring and non-mutating array methods to keep transformations clear.

const { id, title } = post;
const active = users
  .filter(u => u.active)
  .map(u => u.name);

DOM & events

04

Select elements with CSS selectors and attach behavior with event listeners.

const button = document.querySelector('#save');
button.addEventListener('click', save);
Use event delegation for dynamic lists.

Async JavaScript

05

async functions return promises. await pauses only that function—not the thread.

async function loadUser(id) {
  const res = await fetch(`/users/${id}`);
  return res.json();
}

Error handling

06

Throw meaningful errors near the cause; catch them where recovery or reporting is possible.

try {
  await submit();
} catch (error) {
  console.error(error.message);
}

Closures

07

A function remembers variables from the scope where it was created.

function counter() {
  let n = 0;
  return () => ++n;
}

Equality & coercion

08

Use strict equality by default. Know the six falsy primitives: false, 0, '', null, undefined, and NaN.

0 === '0'  // false
Boolean([]) // true

Modern syntax

09

Template literals, spread, optional chaining, and nullish coalescing reduce boilerplate.

const label = `${user?.name ?? 'Guest'}`;
const next = { ...state, ready: true };

Interview pattern

10

For maximum product of three, compare the three largest values with the largest value times the two smallest.

a.sort((x,y) => x-y);
return Math.max(
 a[0]*a[1]*a.at(-1),
 a.at(-3)*a.at(-2)*a.at(-1)
);
No matching concepts. Try a broader search.