Created
April 18, 2020 06:14
-
-
Save allenhwkim/fb4b48b1a3ae3f256c2db33d529910ff to your computer and use it in GitHub Desktop.
print all sessionStorage and localStorage data
This file contains hidden or 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 i; | |
| document.write('<h2>local storage</h2>'); | |
| for (i = 0; i < localStorage.length; i++) { | |
| const key = localStorage.key(i); | |
| const value = localStorage.getItem(key); | |
| document.write(`<li> <b>${key}</b>: ${value}</li>`); | |
| } | |
| document.write('<h2>session storage</h2>'); | |
| for (i = 0; i < sessionStorage.length; i++) { | |
| const key = sessionStorage.key(i); | |
| const value = sessionStorage.getItem(key); | |
| document.write(`<li> <b>${key}</b>: ${value}</li>`); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment