Answers for "localstorage only stores strings"

28

local storage javascript object

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 object
Posted by: Guest on July-22-2019
0

save to local storage

var cat = localStorage.getItem('myCat');
Posted by: Guest on April-27-2020

Code answers related to "localstorage only stores strings"

Code answers related to "Javascript"

Browse Popular Code Answers by Language