1. Functions hoist fully
A function declaration is hoisted with its body, so you can call greet() above the line that defines it.
greet() // works — function declarations are fully hoistedTyporithm · medium
Step 1 of 8 · intro card
Closures & Scope
var declarations are hoisted and initialized to undefined, so reading them early is undefined rather than an error. Function declarations are hoisted whole and callable above their line. let and const are hoisted too but sit in the Temporal Dead Zone until their declaration, so accessing them early throws a ReferenceError.
Function declarations are hoisted entirely — name and body — so you can call greet() on a line above where it is written. This is unique to declarations, not function expressions.
var declarations are hoisted to the top of their scope and initialized to undefined, so reading a var before its assignment gives undefined instead of throwing; only the assignment stays in place.
let and const are also hoisted, but they are not initialized: from the start of the scope until their declaration line they live in the Temporal Dead Zone (TDZ), and any access there throws a ReferenceError.
Function declarations are fully hoisted and callable early.
var hoists to undefined; reading it early is not an error.
let/const sit in the TDZ until their line — early access throws.
greet() // works — function declarations are fully hoisted
function greet() { return "hi" }
console.log(v) // undefined — var is hoisted, initialized later
var v = 1
console.log(c) // ReferenceError — c is in the TDZ
let c = 2Connect each part of the code to the concept before you type.
A function declaration is hoisted with its body, so you can call greet() above the line that defines it.
greet() // works — function declarations are fully hoistedvar declarations are hoisted and initialized to undefined, so reading v before its assignment yields undefined, not an error.
console.log(v) // undefined — var is hoisted, initialized laterOnly the var declaration is hoisted; the assignment v = 1 still runs in place on this line.
var v = 1let/const are hoisted but uninitialized until their line, so touching c earlier throws a ReferenceError.
console.log(c) // ReferenceError — c is in the TDZThe Temporal Dead Zone for c ends at this declaration; from here on c can be read safely.
let c = 2Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.