Promissa sayssessionStorage works like localStorage but clears when the tab closes.
Same API as localStorage (setItem/getItem/…), but scoped to the tab/session: data vanishes when the tab closes and isn't shared between tabs. Use it for per-session state — a multi-step form's progress, a one-visit flag — anything that shouldn't outlive the tab.
Power-ups you unlock
Same API as localStorage
Scoped to the tab; cleared on close
Not shared between tabs
For per-session, ephemeral state
Race Condition Rex attacks — common mistakes
Expecting it to persist across tabs or restarts
Using it for data that should survive a reload-in-new-tab
Confusing its lifetime with localStorage
Boss battleStore a value in sessionStorage and note it’s gone after closing the tab.