JavaScript bank Storage JavaScript / 19 questions Your progress 0 / 19 done Saved in this browser. Reset All 19 Easy 4 Medium 10 Hard 5 Hide done No questions match those filters. 01 Explain `localStorage` — its capacity, synchronous nature, and same-origin scoping. Easy 02 Why should you avoid storing sensitive data like JWTs in `localStorage`? Explain the XSS risk. Medium 03 How would you build a typed wrapper around `localStorage` that handles JSON serialization and quota errors safely? Medium 04 Explain the `storage` event — how can you sync state across multiple browser tabs using `localStorage`? Hard 05 What happens when `localStorage.setItem` exceeds the quota? How should you handle `QuotaExceededError`? Medium 06 Explain how `sessionStorage` differs from `localStorage` in lifetime and scope (per-tab vs per-origin). Easy 07 Does `sessionStorage` persist across a page refresh? Across opening a new tab to the same URL? Explain why. Medium 08 Give a real use case where `sessionStorage` is preferable to `localStorage` (e.g., a multi-step form wizard). Easy 09 How would you persist and restore scroll position per-tab using `sessionStorage`? Medium 10 Explain `HttpOnly`, `Secure`, and `SameSite` cookie attributes and what security threats each mitigates. Medium 11 Compare cookies, localStorage, and sessionStorage in terms of size limits, expiry, and being sent with HTTP requests. Medium 12 Why can JavaScript not read an `HttpOnly` cookie, and why is that a deliberate security feature against XSS? Medium 13 Explain `SameSite=Strict` vs `Lax` vs `None` and their role in CSRF mitigation. Hard 14 Implement a small utility to get, set, and delete a cookie using `document.cookie`. Easy 15 What is IndexedDB and when would you choose it over localStorage for a frontend application? Medium 16 Explain object stores, indexes, and transactions in IndexedDB. Hard 17 Why is the native IndexedDB API callback/event-based, and how do libraries like `idb` wrap it in Promises? Medium 18 Design an offline-first data layer for a note-taking app using IndexedDB with background sync to a server. Hard 19 Explain versioning in IndexedDB (`onupgradeneeded`) and how schema migrations are handled. Hard ← Previous PWA Next → Performance