Loading Depth Study
Preparing your workspace
Web Storage APIs allow browser applications to store string-based key-value data on the client.
localStorage allows data to remain available across browser sessions for the same origin, while sessionStorage is tied to a browser tab's session. These APIs can be useful for simple preferences and temporary client-side state. They are not substitutes for server-side databases and should not be used to store sensitive secrets simply because the browser provides storage.
A website can store a theme preference such as dark mode in localStorage so the preference remains after the browser is reopened.
localStorage.setItem("theme", "dark");
const theme = localStorage.getItem("theme");
console.log(theme);
sessionStorage.setItem("step", "2");dark 2