skij
asked on
JavaScript: Storing and retrieving objects with localStorage
Using JavaScript local storage, how can store an object and then retrieve data from that that object?
Here is an example of my object:
localStorage.setItem('data ', {color:'red', number:5});
When I try to retrieve that data I get [object Object]
alert( localStorage.getItem('data ') );
How can I get the value of data.color from that object?
Here is an example of my object:
localStorage.setItem('data
When I try to retrieve that data I get [object Object]
alert( localStorage.getItem('data
How can I get the value of data.color from that object?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window