JavaScript · Middle · Question 61 of 75

What does new User("Ann") do with a regular constructor function?

Explanation

If the constructor explicitly returns an object, that object replaces this. Calling it without new makes this undefined in strict mode.

Further reading

Problem with a question

JavaScript · Middle · question 61

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz