Created
December 5, 2020 07:07
-
-
Save thepushkarp/40521a50f66920aac55cbc64b334bfd9 to your computer and use it in GitHub Desktop.
Retrieve all local storage items
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
// https://stackoverflow.com/a/17748203/10307491 | |
function allStorage() { | |
var archive = {}, // Notice change here | |
keys = Object.keys(localStorage), | |
i = keys.length; | |
while ( i-- ) { | |
archive[ keys[i] ] = localStorage.getItem( keys[i] ); | |
} | |
return archive; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment