Quick Answer
localStorage: persists indefinitely across sessions, ~5-10MB, synchronous. sessionStorage: same API, but cleared when the tab closes, ~5MB. Cookies: ~4KB, sent with every HTTP request (useful for auth), can expire. IndexedDB: async, large storage (hundreds of MB), supports structured data and transactions รขโฌโ for complex offline apps and caching.
Answer
localStorage: Persistent key-value storage.
sessionStorage: Data persists for session only.
IndexedDB: Client-side NoSQL database for structured data.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.