Learn Basic OOP by Building a Shopping Cart - Step 43

Tell us what’s happening:

You should create a calculateTotal method in the ShoppingCart class.

Above is the error mesage I am receiving.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

calculateTotal()
{
 const subTotal = this.items.reduce((total, this.items)=> total + this.items.price, 0);
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36

Challenge Information:

Learn Basic OOP by Building a Shopping Cart - Step 43

this.items is an invalid parameter name, you can’t use it there

1 Like

just saw that item is the parameter for call back and not items.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.