Last active
October 18, 2020 02:06
-
-
Save tofusoup429/7311b1c57babdea6385a7ebcf3a7341e to your computer and use it in GitHub Desktop.
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
let dataFetchedFromRemote = { | |
name:"ABC corp", | |
address: "4090 Shady Pines Drive Independence VA", | |
postalCode: 24348 | |
} | |
localStorage.setItem('companyInfo', JSON.stringify(dataFetchedFromRemote)) | |
//this code stores the dataFetchedFromRemote in the user's client | |
let companyInfo = localStorage.getItem('companyInfo') | |
let parsedCompanyInfo = JSON.parse(companyInfo); | |
//Data in localStorage is in string-format. Thus, you need to parse before. | |
console.log(parsedCompanyInfo.postalCode) | |
//print 24348 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment