HTML CSS Bootstrap Javascript Icons Python
JavaScript Reference
JS Reference
JS Array Object JS Boolean Object JS Date Object JS Style Declaration Object JS Error Object JS Global Object JS Math Object JS Number Object JS String Object JS RegExp Object JS Statements
DOM Reference
DOM Attribute DOM Console DOM Document DOM Element DOM Events DOM Event Objects DOM History DOM HTMLCollection DOM Location DOM Navigator DOM Screen DOM Style DOM Window WEB Storage

The Storage Object

The Storage object of the Web Storage API provides access to a particular domain's session or local storage.

It allows, for example, the addition, modification, or deletion of stored data items.

To manipulate, for example, the session storage for a domain, a call to window.sessionStorage is made; whereas for local storage the call is made to window.localStorage.

Storage Object Properties and Methods

The following table lists the properties and methods of the Storage object:

Property / Method Description
length Returns an integer representing the number of data items stored in the Storage object
key(n) Returns the name of the nth key in the storage
getItem(keyname) Returns the value of the specified key name
setItem(keyname, value) Adds that key to the storage, or update that key's value if it already exists
removeItem(keyname) Removes that key from the storage
clear() Empty all key out of the storage

Web Storage API

Property Description
window.localStorage Allows to save key/value pairs in a web browser. Stores the data with no expiration date
window.sessionStorage Allows to save key/value pairs in a web browser. Stores the data for one session