Practice ยท 2 of 3
Storage Guard
Write loadSetting(storage, key, fallback) โ storage provides getItem/setItem. Parse the stored JSON safely: missing key, invalid JSON, or wrong-typed value all RETURN fallback; only a value passing isShape (provided as an argument: (v) => boolean) returns { ok: true, value }. Also write saveSetting(storage, key, value) that stores JSON.stringify(value).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Boundaries โ Practice