Browser internals·Intermediate·Conceptual·1 min read
How does sessionStorage differ from localStorage in scope?
Short interview answer
sessionStorage is isolated per browsing-context tab or window and is cleared when that tab closes, while localStorage persists across restarts and is shared by every tab for the same origin.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.