dom-events Flashcards

1
Q

Why do we log things to the console?

A

for tracking and debugging purposes

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

to trigger events when specific events occur

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

Are all possible parameters required to use a JavaScript method or function?

A

no, a function can be called with less arguments than parameters.

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

addEventListener()

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 that is stored in an argument as data, waiting to be called

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 function 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

a reference on the target to which the target was dispatched.

its not the element you applied the eventlistener to, its the element that was interacted with that caused the event to occur

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? hi() or (‘click’, hi)

A

the first is a callback function, the second one is not a callback because the function is actually being called then and there

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