Week 7 Blog Post

Blogging Questions

Describe what the two arguments of the addEventListener method are and how they work. Give four examples of the first argument and give examples of using an anonymous function vs. a declared function for the second argument. Use the code-insert tool for your examples.

The first argument is what the event listener is ‘listening’ for. The second argument is is a function. When the event happens then the function argument will run. An example of this is if a “click” happens it will run a function.

x.addEventListener("click", myFunction);

Leave a comment

Your email address will not be published. Required fields are marked *