JavaScript · Middle · Question 61 of 75
What does new User("Ann") do with a regular constructor function?
- ✓Correct answer: Creates an empty object with
User.prototypeas its prototype, runsUserwiththisbound to it and returns it - 2Copies all methods into a new object
- 3Calls
Useras a normal function
Explanation
If the constructor explicitly returns an object, that object replaces this. Calling it without new makes this undefined in strict mode.