The localStorage object is used to save key/value pairs in the browser. It allows us to do this without any expiration date on the localStorage object. It is not deleted even when the browser is closed and we can use it for future purposes.
Its syntax is:-
window.localStorage OR localStorage
localStorage.setItem(key, value) for setting Item on localStorage
localStorage.getItem(key) for getting Item from localStorage
localStorage.removeItem(key) for removing Item from localStorage
localStorage.clear() for clearing Everything in localStorage
Its return is:- a localStorage object
|Required. The name of a key.
|Required. The value of the key.