Dom-Events Flashcards

1
Q

Why do we log things to the console?

A

to check our work. Confirm our assumption

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
  1. events are observing some type of actions to happen.

2. event handling is to execute a function based on that event.

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

It is optional don’t have to include that.

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

Add event listener. –> broswer listening

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

What is a callback function?

A

Function that is passed into another function

FUNCTION THAT WE DO NOT CALL!!! we give that autohrity to an object or something else!

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

object that has all the information about the event and throws it as a first argument. (event!)

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
  1. event.target is the property that triggers the event.

2. look up on MDN.

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?

(‘click’, handleClick) Vs. (‘click, handleClick());

A
  1. w/o () –> function definition.
  2. w/ –>return value of function –> will return undefined.

If you pput () it will call back right away!, YOU DO not want that!
With anyonymous function, you can put another variable. (MORE DATA!), named function you CAN’T!!
in named function only can pass event parameter.

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