Learn Basic OOP by Building a Shopping Cart - Step 35

Tell us what’s happening:

I always get error that I sould use arrow syntax to add a callback function to forEach that takes btn parameter, but I did it

Your code so far

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

/* file: styles.css */

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

[...addToCartBtns].forEach(
  (btn) => btn.addEventListener("click", (event) => {})
);

// 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/129.0.0.0 Safari/537.36 Edg/129.0.0.0

Challenge Information:

Learn Basic OOP by Building a Shopping Cart - Step 35

it seems to want the braces around the arrow function body so rewrite your code so there is a { after the (btn) => and another } at the end of that line

1 Like