Learn Basic OOP by Building a Shopping Cart - Step 35

Tell us what’s happening:

Your code so far

const addToCartBtns = document.getElementsByClassName("add-to-cart-btn");

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

##Step 35

Add your callback function to the forEach method. It should take a btn parameter. Then, in the callback, add an event listener to the btn. The event listener should listen for a click event, and should take another callback with an event parameter. The second callback should be empty

##Challenge: I have added event as parameter and second callback is empty still I am getting error that Sorry, your code does not pass. Try again.

You should add an empty callback function to the event listener. Remember to give it an event parameter.

Challenge Information:

Hi @codebyrupali

For step 35, please remove the semi colon at the end of the code.

Happy coding

I have created an issue for this because we shouldn’t be strict about semicolons here