Learn Basic OOP by Building a Shopping Cart - Step 60

Tell us what’s happening:

clearCartBtn.addEventListener(“click”,(cart.clearCart.bind(cart)()))
Does’nt work. Why>

Your code so far

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

/* file: styles.css */

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

clearCartBtn.addEventListener("click",(cart.clearCart.bind(cart)()))

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15

Challenge Information:

Learn Basic OOP by Building a Shopping Cart - Step 60

The brackets () invoke/call the function immediately (rather than being bounded to the button). It’s an IIFE (Immediately Invoked Function Expression).

https://developer.mozilla.org/en-US/docs/Glossary/IIFE

Thank you it works now