Last active
January 12, 2019 18:45
-
-
Save apolopena/2b6989c85fa7a32e626b83ccade9798e to your computer and use it in GitHub Desktop.
JavaScript: Get all data in 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
function allStorage() { | |
var archive = [], | |
keys = Object.keys(localStorage), | |
i = 0, key; | |
for (; key = keys[i]; i++) { | |
archive.push( key + '=' + localStorage.getItem(key)); | |
} | |
return archive; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment