What is the `e` parameter in the input event handler function?

Question

In this exercise, we define the method handleUserInput(e) with a parameter e. What is this e parameter?

Answer

The e parameter of the function is an optional parameter of the input event handler which equals to a JavaScript Event object that contains information regarding what action or event just happened. When the handleUserInput() function is invoked, the action that occurs, like a change in the input field, is passed as the value of e. Then, the information about the action can be accessed, such as e.target.value, which would be the value of the text input element.

7 Likes