javascript-constructors Flashcards

1
Q

What does the new operator do?

A

It lets developers create an instance of a user-defined object type or of one of the built-in object types that has a constructor function.

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

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

A

Prototype property

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

What does the instanceof operator do?

A

The new keyword does the following things:
1. Creates a blank, plain JS object
2. Assigns anything on the prototype property to the proto property of the new object
3. Binds ‘this’ to the new object that is being created
4. Returns the object

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