Valid JS-Dev-101 Dumps shared by EduDump.com for Helping Passing JS-Dev-101 Exam! EduDump.com now offer the newest JS-Dev-101 exam dumps, the EduDump.com JS-Dev-101 exam questions have been updated and answers have been corrected get the newest EduDump.com JS-Dev-101 dumps with Test Engine here:
01 function Monster() { this.name = 'hello'; }; 02 const m = Monster(); What happens due to the missing new keyword?
Correct Answer: B
________________________________________ Comprehensive and Detailed Explanation From Exact Extract JavaScript Knowledge In JavaScript, when calling a constructor function without new: const m = Monster(); the following happens: The function executes as a normal function, not as a constructor. Inside a regular function (in non-strict mode), this refers to the global object: In a browser: window So the line: this.name = 'hello'; becomes: window.name = 'hello'; Since Monster() does not return anything, its return value is undefined: const m = undefined; Therefore: m is undefined window.name becomes "hello" This matches option B. ________________________________________ JavaScript Knowledge Reference (text-only) Calling a function without new uses the global object as this in non-strict mode. Constructor functions must use new to create a new object. Functions without an explicit return return undefined.