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:
A developer has two ways to write a function: Option A: 01 function Monster() { 02 this.growl = () => { 03 console.log("Grr!"); 04 } 05 } Option B: 01 function Monster() {}; 02 Monster.prototype.growl = () => { 03 console.log("Grr!"); 04 } After deciding on an option, the developer creates 1000 monster objects. How many growl methods are created with Option A and Option B?
Correct Answer: C
Option A: this.growl = () => { ... } inside the constructor creates a new function per instance. For 1000 new Monster(), you get 1000 distinct growl functions, each stored on the instance itself. Option B: Monster.prototype.growl = () => { ... } attaches growl to the prototype. All instances share the same single growl function via the prototype chain. For 1000 instances, only 1 growl method exists in memory. So: Option A → 1000; Option B → 1. ________________________________________