HTML and CSS Reference
That's it! You have now successfully implemented LocalStorage into your website.
Try opening up the Bookings page and entering some data into the form. When you click the Request Booking but-
ton, the contact details will be saved. Go back to the Bookings page and you should see that the Name, Phone, and
Email fields are already populated when the page loads. Figure 12-5 shows how this looks in your web browser.
Using the LocalStorage API to enhance your web forms in this way can be beneficial to users. In the next section,
Figure 12-5 The Name, Phone, and Email fields are populated from data stored in LocalStorage.
Storing Objects and Arrays
Until now, you looked only at how to store text and numbers using LocalStorage. In this section, let's look at how
you can store more complex data such as objects and arrays.
A key component in storing these types of data is the use of a data interchange format called JSON.