What happens due to lack of the new keyword on line 02?

A developer wants to create an object from a function in the browser using the code below:

Function Monster() { this.name = ‘hello’ };

Const z = Monster();

What happens due to lack of the new keyword on line 02?
A . The z variable is assigned the correct object.
B . The z variable is assigned the correct object but this.name remains undefined.
C . Window.name is assigned to ‘hello’ and the variable z remains undefined.
D . Window.m is assigned the correct object.

Answer: C

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments