save to local storage
localStorage.setItem('myCat', 'Tom');
var cat = localStorage.getItem('myCat');
localStorage.removeItem('myCat');
// Clear all items
localStorage.clear();
save to local storage
localStorage.setItem('myCat', 'Tom');
var cat = localStorage.getItem('myCat');
localStorage.removeItem('myCat');
// Clear all items
localStorage.clear();
local storage javascript
function createItem() {
localStorage.setItem('nameOfItem', 'value');
}
createItem() // Creates a item named 'nameOfItem' and stores a value of 'value'
function getValue() {
return localStorage.getItem('nameOfItem');
} // Gets the value of 'nameOfItem' and returns it
console.log(getValue()); //'value';
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us