Last active
September 10, 2018 09:03
-
-
Save qkreltms/2be842339b63f5b4c952626105b89d94 to your computer and use it in GitHub Desktop.
Simple javascript local storage usage example with JSON
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
| <html> | |
| </html> | |
| <script> | |
| let a = { | |
| test1: 1, | |
| test2: 2 | |
| } | |
| localStorage.setItem('test', JSON.stringify(a)) | |
| let temp = JSON.parse(localStorage.getItem('test')) | |
| var text = document.createTextNode(temp.test1) | |
| document.body.appendChild(text) | |
| </script> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.stringify(a) 대신 .json(a) 써도 됨