Skip to content
JobNetWork
← All Prep Trek tracks

JavaScript, in 10 cards

No chapters to read. Each card gives you the one-line answer, a picture, a quick try-it and the trap interviewers hope you fall into. About 15 minutes for all ten.

0 of 10 done

Card 1 of 10 · Basics

var vs let vs const: what is the difference?

Say this first

var is function-scoped and hoisted as undefined. let and const are block-scoped and cannot be used before their line. const cannot be reassigned.

Picture it

varletconst
ScopeFunctionBlockBlock
Before its lineundefinedReferenceError (temporal dead zone)ReferenceError
ReassignYesYesNo (but an object's contents can change)
Use todayAvoidWhen it changesDefault choice

Try it

What does console.log(b); var b = 1; print?

Common trap

Saying const makes a value immutable. It only stops reassigning the variable; an object or array can still be changed.

Say it like this

I default to const, use let when a value changes, and avoid var because of its function scope and hoisting.

Full JavaScript notes

Want the rest?

The free cards cover the core. The full notes add 14 more cards in the same style, plus a cheat sheet:

  • • Pass by object reference, scope, lambda, map and filter
  • • Dict internals, sorting, strings, iterators and the with statement
  • • Class vs instance attributes, MRO, __str__ vs __repr__, method types
  • • Memory management and the dict and Counter coding patterns
See guides →

A prep aid, not a guarantee of a job.