javascript-this Flashcards

1
Q

What is this in JavaScript?

A

this is an implicit parameter that accesses the object that contains that this keyword when that property or method is called.

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

What does it mean to say that this is an “implicit parameter”?

A

An implicit parameter is a parameter that does not have to be explicitly added during the function definition.

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

When is the value of this determined in a function; call time or definition time?

A

During call time.

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

How can you tell what the value of this will be for a particular function or method definition?

A

You cannot tell what this will equal until it is called.

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

How can you tell what the value of this is for a particular function or method call?

A

Check the object containing the method when it is called and that will have the value of this or for a function with no containing object it will have the global Window object as its “this” object. If there is an object name to the left of a method call then the this value will be that object.

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