`localStorage` persists per origin until cleared; `sessionStorage` lasts for the tab. Both store strings only, are synchronous, and are readable by any script on the origin.
localStorage.setItem("progress", JSON.stringify(state));
const state = JSON.parse(localStorage.getItem("progress") ?? "{}");Never store private keys, seed phrases or bearer tokens there. Wrap access in try/catch — private modes can throw.