For this final chapter, I thought it would be a good idea to see several of the things that have been demonstrated in small examples throughout the previous chapters. What better way to do that than with a shopping cart?
Let’s begin by defining the goals of the shopping cart:
I think that covers the core features of a typical shopping cart. By looking at these features, I see an immediate need for three arrays:
In addition to these three arrays, we want to keep track of the current running total.
Example 10-1 shows the HTML that covers the shopping cart’s features.
<title>Yet Another Shopping Cart