save object in localstorage shows [object Object]
Looking at the Apple, Mozilla and Mozilla again documentation, the functionality seems to be limited to handle only string key/value pairs.
A workaround can be to stringify your object before storing it, and later parse it when you retrieve it:
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));
Also in JavaScript:
- js detect all images errors
- device width javascript
- mongoose virtual populate not working
- react lifecycle hooks
- atob nodejs
- get top items from json object
- loopback not null
- js redirect code
- trigger click jquery
- document queryselectorall and map javacript
- boble sorting javascript
- javascript rpg tutorial
- js console log input value
- jquery datatable draw false
- login form validation using pattern in angular
- math.random js
- javascript add row to table
- javascript switch statement multiple cases
- how to add onclick event in javascript
- remove dom elements
- javascript get browser is electron
- c# print object to json
- devtools failed to load sourcemap when debugging react native
- Parallax.js wrapper for react