Skip to content

Instantly share code, notes, and snippets.

@apolopena
Last active August 21, 2024 14:33
Show Gist options
  • Select an option

  • Save apolopena/2b6989c85fa7a32e626b83ccade9798e to your computer and use it in GitHub Desktop.

Select an option

Save apolopena/2b6989c85fa7a32e626b83ccade9798e to your computer and use it in GitHub Desktop.
JavaScript: Get all data in localStorage
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