js constructors Flashcards

1
Q

What does the new operator do?

A
  1. creates blank JS object
  2. Adds propert to new object (__proto__) that links the constructor functions prototype object
  3. Binds newly created object as the this context
  4. Returns this if function doesn’t return object
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

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

What does the instanceof operator do?

A

returns boolean that tests if prototype property of a constructor appears anywhere in prototype chain of the object

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