The readers of my articles on several forums asks questions regarding something or the other and I do answer them promptly. However I feel the answers should be shared among a larger group of people. I think this blog will make this possible.
Showing posts with label JSON.Stringify(). Show all posts
Showing posts with label JSON.Stringify(). Show all posts
Friday, February 2, 2018
Thursday, February 1, 2018
Sunday, January 28, 2018
How do you store an array in Local Storage?
My previous post showed how to store a single piece of information in Local Storage (Browser Storage). However instead of a single piece of data you want to store an array of items.
Let us say your array has three elements, rose, jasmine and hyacinth and you want to store in an array named 'flowers'.
The following page shows how you may store array and retrieve array elements using JavaScript. Each statement is commented (view image magnified, if necessary).
ArrayStoreLocalStorage.png
Place this page in IIS's wwwroot folder and browse. You can see the elements in the array in LocalStorage.
ArrayStoreLocalStorage1.png
You can see more clearly here in the Microsoft Edge's developer window. Data stored from the previous post is also seen.
Let us say your array has three elements, rose, jasmine and hyacinth and you want to store in an array named 'flowers'.
The following page shows how you may store array and retrieve array elements using JavaScript. Each statement is commented (view image magnified, if necessary).
ArrayStoreLocalStorage.png
Place this page in IIS's wwwroot folder and browse. You can see the elements in the array in LocalStorage.
ArrayStoreLocalStorage1.png
You can see more clearly here in the Microsoft Edge's developer window. Data stored from the previous post is also seen.
ArrayStoreLocalStorage2.png
Subscribe to:
Posts (Atom)




