Created
February 21, 2012 08:14
-
-
Save robnyman/1875070 to your computer and use it in GitHub Desktop.
JSON and localStorage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cast = { | |
"Adm. Adama" : "Edward James Olmos", | |
"President Roslin" : "Mary McDonnell", | |
"Captain Adama" : "Jamie Bamber", | |
"Gaius Baltar" : "James Callis", | |
"Number Six" : "Tricia Helfer", | |
"Kara Thrace" : " Katee Sackhoff" | |
}; | |
// Stores the JavaScript object as a string | |
localStorage.setItem("cast", JSON.stringify(cast)); | |
// Parses the saved string into a JavaScript object again | |
JSON.parse(localStorage.getItem("cast")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment