Skip to main content

Practice · 3 of 3

Failure Messages That Help

CHALLENGE
Difficulty: intermediate+25 XP

Write fmt(v) producing readable failure output: strings render with quotes, undefined/null render as their names, arrays render as [a, b, c] with fmt applied to items, plain objects render as {k: v, ...} with fmt values, functions render "function", everything else String(v).

Back to lesson: Practice: Build Your Own Assertions — Practice