Skip to main content

Command Palette

Search for a command to run...

Local storage:

Published
1 min readView as Markdown

Local Storage

Local storage is used to persist data in the browser level.

Data is not lost even after the browser is closed, or even after the OS is rebooted.

It has 5MB of memory capacity.

Local storage has four methods:

setItem:

localStorage.setItem(key, value)
localStorage.setItem("name", "Murali")
//stores the data in browser

getItem:

localStorage.getItem("name")
//O/p: Murali
//This method is Retrieves the data from local Storage

removeItem:

localStorage.removeItem("name")
//This is method is used to remove the value stored in the memory in reference to key.

clear():

localStorage.clear()
//This method is used to clear all the values stored in localstorage.

More from this blog

Chowhan's blog

29 posts

A Passionate software developer