dom-events Flashcards

1
Q

Why do we log things to the console?

A

For debugging properties

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of events and event handling?

A

Events help determine how the user interacts with the web page. Event handling helps us create actions around their interactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What do [] square brackets mean in function and method syntax documentation?

A

Access properties or the index value of an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What method of element objects lets you set up a function to be called when a specific type of event occurs?

A

Event listener.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a callback function?

A

A function being passed as an argument to another function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What object is passed into an event listener callback when the event fires?

A

The event object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the event.target? If you weren’t sure, how would you check? Where could you get more information about it?

A

It shows the target that the event occured on. console.log. the event object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between these two snippets of code?

element. addEventListener(‘click’, handleClick)
element. addEventListener(‘click’, handleClick())

A

The latter’s callback function is being called immediately the event listener runs while the former is being passed to allow the element to determine when the function runs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly