Local Storage API, Storing and Retrieving Simple Data, Arrays, Associative Arrays, and Objects

We can add data on the browser in two ways, with local storage and with sessions.

With local storage the data doesn't get cleaned up automatically, with sessions, the data is lost when the browser closes.

Here's an example of data stored that was stored locally, printed out:

Here's an example using local storage to get a list of colors from the user and print them out one by one, using an array.

Enter Your Favorite Colors:

Colors