Link to home
Start Free TrialLog in
Avatar of skij
skijFlag for Canada

asked on

JavaScript: Getting data from objects with localStorage

Using JavaScript, how can I access data from an object stored with local storage?  This does not work:

This does not work:
 localStorage.setItem('data', {color:'red', number:5});
 alert( localStorage.getItem('data').color );

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanx 4 axxepting
Avatar of skij

ASKER