← Back to archive

Stdle #125 · namespaces · 2026-10-09

What does this TypeScript snippet output?

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

function calc(n: number) { return n * 2 }
namespace calc { export function half(n: number) { return n / 2 } }
console.log(calc(10) + calc.half(10))
Namespaces
4 attempts left

Answer & explanation