© Russ Ferguson 2019
Russ FergusonBeginning JavaScripthttps://doi.org/10.1007/978-1-4842-4395-4_6

6. JavaScript and Events

Russ Ferguson1 
Ocean, NJ, USA

In the last chapter, you learned how functions work and the difference between arrow functions and function expressions. You also learned how the execution context controls the keyword this and the built-in methods used to create a more predicable way of working with it.

Functions are often called because of an event. Events can be things like a page loading or a button click. JavaScript allows you to “listen” for events and then execute a function in response to the event.

In this chapter, you will learn how to use the combined knowledge from the previous chapters and start to develop some interaction ...

Get Beginning JavaScript: The Ultimate Guide to Modern JavaScript Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.