1. Introduction

Modern websites need to store data:

JavaScript provides Web Storage APIs and JSON to store and exchange data efficiently.


2. Web Storage in JavaScript

Web Storage allows browsers to store data locally on the user’s device.

Types of Web Storage

  1. localStorage
  2. sessionStorage

Both store data as key–value pairs (strings only).


3. localStorage

What is localStorage?