#HELP NEEDED PLEASE
3 messages · Page 1 of 1 (latest)
Good morning, Lyle!
It looks like quantity isn't being declared in the calculateTotal() function or the .reduce() method. Also in the return statement for calculateTotal() change it to be:
return price * quantity;
The code says return accumulate = price * quantity but assigning a value to accumulate isn't necessary since the reduce() method automatically does that with the return statement.
I hope this helps 🙂
Thank you @golden crater. I changed the code instead using cart.forEach(item =>{ total += eval(item.price)})
totalElement.textContent = $${total}