Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function displayArrayfromLocalStorage() {
- // an array of pets I have previously owned
- var pets = ["dog", "cat", "hamster", "otter", "cat"];
- //Add the array to local storage
- localStorage.animalList = pets;
- //Retrieve it
- console.log(localStorage);
- alert(localStorage.animalList);
- }
Add Comment
Please, Sign In to add comment