Look at the source, this is an example of event handlers in JavaScript

we will be changing the default behaviour of an event

if one of the input fields is missing the action for this form is to display an error and not send to server (preventDefault)

if both input fields have data it will log the information and send to the server.

take a look at the console in the dev tools, the object is logged