Skip to main content

Practice · 1 of 3

Safe JSON Parse

CHALLENGE
Difficulty: intermediate+25 XP

Write safeParse(json, fallback) that RETURNS the parsed value when json is valid JSON, and RETURNS fallback when it is not. It must never throw, whatever the input.

Back to lesson: Practice: Error Handling — Practice