1localStorage.setItem('user_name', 'Rohit'); //store a key/value
2var retrievedUsername = localStorage.getItem('user_name'); //retrieve the key
1localStorage.setItem("user_name", "Bob");
2
3document.body.addEventListener("click", function(){
4 alert(localStorage.getItem("user_name"))
5});
1function populateStorage() {
2 localStorage.setItem('bgcolor', 'red');
3 localStorage.setItem('font', 'Helvetica');
4 localStorage.setItem('image', 'myCat.png');
5}