Practical tasks to perform and ensure that the basis of the chapter has been understood.
Assignment 1 (mandatory)
Store a single value
Create any web application or use a previous assignment where something can be changed by the user, like switching the background color every time an element is clicked/touched.
Extend that application with storing the current value in web storage every time it is changed.
Make sure that when the application starts (the page is loaded) that same value is read and used (by, for instance, setting the initial background color).
Assignment 2 (optional)
Store and retrieve JSON data
Create a web application with at least two input fields and a save button.
The labels and contents of the input fields are not important, lets say it is a name and a phone number.
When the user clicks the save button, the values in the input fields should be saved in JSON format in web storage.
When the web application starts (the page is loaded), any saved values in JSON format should be read and placed as default values in the two input fields.
Assignment 3 (optional)
Retrieve and show JSON data from network request
Continue on the previous assignment or create a new web application with similar content.
Create a separate file with JSON data for the application. It can be the default data to use for all new users. It should have the same data as is stored in web storage and the input fields.
Create a new button/link in the application to load that JSON data file.
Fill the input fields with the data from the JSON file.