JavaScript Events Worksheet

Questions

Question 1

What is an 'event handler'?

An even handler is a way to use JavaScript on the page when you want a certain action to be preformed. A function that handles an event

Question 2

How are event handlers invoked?

the browser invokes event handlers when the event occurs. addEventListener();

Question 3

What is an 'anonymous' function?

its an unnamed function.

Question 4

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

It is a specific instruction to handle different actions(events) you want performed on the DOM, highlighting a specific section of text if the mouse hovers over it for example. Params used will be the action taken, like a mouse click, and a function.

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