Coding / Programming Videos

Post your favorite coding videos and share them with others!

[JavaScript] Web Storage API – Aaron Lu – Medium

Source link

Storage Interface

The Storage interface 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.

Both localStorage and sessionStorage are instances of the Storage interface.

Properties

Storage.length

Methods

Storage.key(n): Return the name of the nth key in the storage.

Storage.getItem('key'): Return value.

Storage.setItem('key', 'value'): When passed a key name and value, will add that key to the storage, or update that key’s value if it already exists.

Storage.removeItem('key'): When passed a key name, will remove that key from the storage.

Storage.clear(): Empty all keys out of the storage.

Source link

Bookmark(0)
 

Leave a Reply

Please Login to comment
  Subscribe  
Notify of
Translate »