Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago