A function declaration is hoisted (Phase 10). A function expression is a value you assign — it is not available before that line runs.

Results appear here.

Pick a form to greet the name above.

Important JavaScript

// 1) Declaration — hoisted, can call above this line
function greetDecl(name) {
  return "Hello, " + name;
}

// 2) Anonymous function expression — stored in a const
const greetExpr = function (name) {
  return "Hello, " + name;
};

// 3) Named function expression — useful in stack traces
const greetNamed = function greetInner(name) {
  return "Hello, " + name;
};

greetExpr("Ava");
// greetExpr is not hoisted — using it before the const line throws.