This recipe shows how to add and remove an event listener to an HTML element.
Clicking the "Add listener" button will add an event listener to the button. When the main button is clicked, a message will be printed to the console. Clicking the "Remove listener" button will remove that event listener.
Clicking the "Remove 2nd Approach listener" button is self-explanatory.
Make sure to open the console with dev tools first, then reload/refresh the page.