hat are the two methods on the localStorage object that allow you to read and write data js code example
Example 1: local storage
function setItem(name, value) {
localStorage.setItem(name, value);
}
function getItem(name) {
localStorage.getItem(name);
}
function deletItem(name) {
localStorage.removeItem(name);
}
function clearStorage() {
localStorage.clear();
}
Example 2: local storage javascript
localStorage.setItem('user_name', 'Rohit');
var retrievedUsername = localStorage.getItem('user_name');