Start here. This is the direct spoken answer to practice first.
Overview
The choice begins with who needs the data and how long it should live. No browser store turns client-controlled data into trusted state.
Cookies are small values the browser can send with matching HTTP requests, so they suit server sessions when configured securely. sessionStorage is scoped to a tab session, while localStorage persists for the origin and exposes a synchronous string API. IndexedDB is asynchronous and better for larger structured or offline data. I choose based on lifetime, size, access pattern, and security.