Is a way for the browser to remember stuff. That it want to use later.
sessionStorage vs localStorage
var names = ["Ayabonga"];
- localStorage only stores strings
- as a result one need to convert the stored string into an Object using
JSON.parse
- to store an Object as a string we need to use
JSON.stringify
- as a result one need to convert the stored string into an Object using
- The word localStorage - it's used in to many places. Github got it a well :-(
- Where I can use localStorage?
- How can I use it?
- About the syntax of JSON?
- Get what is in the localStorage store it into a variable.
- Be sure to convert the variable into an JS Object using
JSON.parse
- you might need to useparseFloar
orNumber
when you are working with a number. - When storing objects to localStorage be sure to use
JSON.stringify
to convert it into a string to be stored. - You can use a for loop to test that your data is read from localStorage correctly. * if you see alot of lines below each other it means that you read a string from localStorage and you didn't convert that into a list of objects