← Back to archive

Stdle #18 · scope · 2026-06-18

What does this JavaScript snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

const f = function fact(n) { return n <= 1 ? 1 : n * fact(n - 1); };
console.log(f(4), typeof fact === "undefined" ? "undefined" : "defined");
Scope
4 attempts left

Answer & explanation