JavaScript Events Worksheet

Questions

Question 1

What is an 'event handler'?

Functions that are used to when an event occurs.

Question 2

How are event handlers invoked?

When you run a code you'll see that the event will be invoked.

Question 3

What is an 'anonymous' function?

A function with no name.

Question 4

Explain what the addEventListener() method of a DOM element is, and explain the purpose of each of it's parameters.

Hooking up event handler functions. The first parameter is a string which is the name of the event you want to listen for. The second parameter is a function, which is the event handler that will be invoked by the browser detects the events.

Coding Problems

Coding Problems - See the 'script' tag below this h3 tag. You will have to write some JavaScript code in it.

Always test your work! Check the console log to make sure there are no errors.

Orange

Green