LocalStorage vs SessionStorage
Multiple Choice Easy
Question
What is the key difference between localStorage and sessionStorage?
Hint
Think about what "session" implies.
Explanation
sessionStorage data is cleared when the browser tab or window is closed, while localStorage persists until explicitly cleared by code or the user. Both store string key-value pairs with a limit of about 5-10MB per origin. Use localStorage for persistent preferences and sessionStorage for temporary session data.
Related Resources
Related Lessons
- Web Storage
Learn web storage.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.