How to save and read data from local storage in JavaScript?
We can save data in Local Storage with the help of setItem() method of localStorage object.
Example:
localStorage.setItem( "userInfo", {
    "name": "John",
    "gender": "male",
    "age": 30,
    "email": "test123@gmail.com"
} );
We can get the stored data using getItem() method of localStorage object.
Example:
localStorage.getItem( "userInfo" );
 
                                    