javascript store object in local storage
var person = { "name": "billy", "age": 23};
localStorage.setItem('person', JSON.stringify(person)); //stringify object and store
var retrievedPerson = JSON.parse(localStorage.getItem('person')); //retrieve the objectvar 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));
Also in JavaScript:
- jquery show flex
- nodejs download image from url
- javascript factorial of a number
- react hooks delete item from array
- edit html element javascript
- http requests in vue 3
- tranary operator in js
- create react app and tailwind
- download image in nodejs
- js log stack trace
- javascript for loop starting from end
- javascript try catch finally
- detecting change in animated value react native
- getting value from radio button javascript
- outputstream to image js example
- js indexof string
- how to add multiple style attributes in react element
- variable arguments js
- jquery validator Url
- google maps api javascript
- allow cross origin node
- javascript global function
- make string json object vue
- typescript express next middleware type