Created
April 10, 2021 22:06
-
-
Save hebertcisco/1c2af48843354122da5430052d9b20b8 to your computer and use it in GitHub Desktop.
Armazenando dados 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
// Armazenando dados: | |
meuObj = {nome: "Hebert", idade: 19, cidade: "Gyn"}; | |
meuJSON= JSON.stringify(meuObj ); | |
localStorage.setItem("testJSON", meuJSON); | |
// Recuperando dados: | |
text = localStorage.getItem("testJSON"); | |
obj = JSON.parse(text); | |
document.getElementById("demo").innerHTML = obj.name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment