← Code LabJavaScript0/50 solved · 0%
Errors · medium

27. throw & try/catch

Fail loudly, recover gracefully.

Write `parseAmount(str)` that throws `new Error("invalid amount")` for non-numeric input, and `safeParse(str)` returning 0 instead of throwing.
Required in your answer: throw new Errortrycatch