javascript storage get set item
var testObject = { 'one': 1, 'two': 2, 'three': 3 };
// Put the object into storage
localStorage.setItem('testObject', JSON.stringify(testObject));
// Retrieve the object from storage
var retrievedObject = localStorage.getItem('testObject');
console.log('retrievedObject: ', JSON.parse(retrievedObject));function set(){
var sendJson = JSON.stringify(arrayName);
localStorage.setItem('key',sendJson)
}// *** JS Storage Get/Set item ***
let target = document.getElementById("target");
let increment = document.getElementById("increment");
let count = localStorage.getItem("counter") || 0;
target.innerHTML = count;
increment.addEventListener("click", () => {
count++;
localStorage.setItem("counter", count);
target.innerHTML = count;
})
Also in JavaScript:
- change array index position in javascript by up and down click
- react strict mode
- how to use reduce in javascript
- js check proccess alive
- detect scroll javascript
- simple node server
- vue js getter
- Javascript function to transform string to add character upfront - 1 21 321
- javascript toisostring without milliseconds
- how to iterate through a js object
- time stamp to date js
- hot to start cypress
- javascript for loop[
- [Unhandled promise rejection: Error: Reference.update failed: First argument contains undefined in property 'orders.-MN6f-JxMnLS4qAmVfs0.info.other_phone']
- how to transpose json data
- count occurrences of character in string javascript
- React site warning: The href attribute requires a valid address. Provide a valid, navigable address as the href value jsx-a11y/anchor-is-valid
- remove selected bar mui tabs
- forjs check if key in json
- post express node js input
- javascript skip default parameter
- react native components
- gi js
- how to run a js file in node