Javascript-constructors-Q&A Flashcards
1
Q
What does the new operator do?
A
The new operator 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.
- Created blank object
- Adds property to new object (__prototype__)
- Binds the newly created object instance as the this contex
- returns the object
2
Q
What property of JavaScript functions can store shared behavior for instances created with new?
A
prototype property
3
Q
What does the instanceof operator do?
A
instanceof is a binary operator used to test if an object is of a given type.