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.
Press Submit to check your solution.
Back to lesson: Practice: Error Handling — Practice