OOP Javascript Flashcards

1
Q

What is a method?

A

method is a function which is a property of an object

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

How is a method different from any other function?

A

it can only be used by its object

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

What is this in JavaScript?

A

when is this?

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

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

A

it is not explicitly stated so it is more flexible as to what it can do

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

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

A

value of “this” is determined in call time

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

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

A

we can look at its scope

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

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

A

the object that calls the method will be “this”

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

What kind of inheritance does the JavaScript programming language use?

A

prototypal inheritance

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

What is a prototype in JavaScript?

A

prototype is an object that is associated with every functions and objects by default

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

How is it possible to call methods on strings, arrays, and numbers even though those methods don’t actually exist on objects, arrays, and numbers?

A

by using methods in the prototype object

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

If an object does not have it’s own property or method by a given key, where does JavaScript look for it?

A

prototype

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

What does the new operator do?

A

it can construct a new object

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

What property of JavaScript functions can store shared behavior for instances created with new?

A

prototype

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

What does the instanceof operator do?

A

checks to see if an object was made using a specific constructor

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