How to Use Local Storage in Javascript

Hello Developer

Today We are Learning How to Use Local Storage in Javascript  this is the easy way to HTML5 JavaScript Web Storage using localStorage and sessionStorage. You have to use the inbuilt function of Javascript to set data and You can get data in other page or same Page from Localstorage.

The set data save in Your Local Storage of Your Browser and You can Get Data as Per Your Need.

First We Discuss about how to set data in the Local Storage in HTML. You have to use “setItem” function to Set Data.

localStorage.setItem("variable-name","value");

Example

localStorage.setItem("lastname","Karan");


Now You can Get Set Data in Other Page or Same page. You have to use “getItem” function to get Data.

var your-data= localStorage.getItem("variable-name");

var name = localStorage.getItem("lastname");

For More Detail You can Watch Our Video

Thank You

Leave a Reply

Your email address will not be published. Required fields are marked *