Skip to main content

Practice ยท 1 of 1

Remember the Theme

A storage object is provided that works like localStorage (setItem/getItem/removeItem). 1. Write saveSettings(settings) that stores the settings object as JSON under the key "settings". 2. Write loadSettings() that reads the key and RETURNS the parsed object โ€” or the default { theme: "light" } when nothing is stored. 3. Save { theme: "dark", fontSize: 16 }, then load it and log the theme โ€” should print dark.

Difficulty: intermediate

Back to lesson: Practice: Browser Storage: localStorage + JSON โ€” Practice