Hi guys!
I am currently working on an ecommerce project for my web portfolio and decided to add a shopping cart. I imagined that Javascript would be the best language for the task. Entries in the shopping cart were manually added (screenshot attached).
My initial thoughts were to:
- Create an empty array and assign it to “cart” variable
- Create an “item” class and use items from an inventory list to create instances of the “item” class
- Create for loop to append objects to cart array
- Append cart to div in HTML
My question is, what is the best way to create a shopping cart? Your feedback would be appreciated. Thanks.