Local storage:

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.