5 hands-on exercises and 5 find-the-bug challenges for the JavaScript Custom Events lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Create and fire an event called itemAdded, then report it was heard.
Pass a name in detail and report it.
Fire the event on the inner div so the outer one hears it.
Fire a themeChanged event on document and report the detail.
Attach two listeners to one custom event and report that both ran.
Creating an event does not fire it.
Data travels in detail, not in a property of your own.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspaceA custom event does not bubble unless it is told to.
The listener is on the cart, so the event must be fired there.
A plain Event cannot carry a detail property.