During creation, function declarations are fully hoisted. let and const are also known early, but they stay in the Temporal Dead Zone until their declaration runs — reading them first throws a ReferenceError.

Try each button and compare the results.

Important JavaScript

// Works — the whole function is hoisted
greet();
function greet() {
  return "Hello";
}

// Throws ReferenceError — TDZ for let/const
console.log(score);
let score = 10;

console.log(name);
const name = "Ava";