Question: I am new to coding I am lost and I still don't understand what I am doing. I need help with this lesson and I

I am new to coding I am lost and I still don't understand what I am doing. I need help with this lesson and I will like a step by step explanation if possible here is the problem:

* Diego needs you to get the Cart Totals working. Complete the following: 1. Loop through all the items in the cart and add up the `price` for each item, storing the result in `subtotal`. 2. Set the `total` variable equal to the `subtotal` plus the `shipping` cost. */

let cart = [ {

itemName: "Walnut Guitar Mount",

price: 62.0, },

{ itemName: "Wooden Guitar Pick Box",

price: 8.5, },

{ itemName: "Mahogany Guitar Stand",

price: 149.99, }, ],

let subtotal = 0;

let shipping = 12.99;

let total = 0;

It keeps saying when I run my solution let is a reserved word and in red SYNTAXERROR... I dont understand what this means and this what I have as a solution:

for (let i = 0; i < cart.length; i++) { subtotal += cart[i].price; }

total = subtotal + shipping;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!