JS-Dev-101 practice question 4 of 25

01 function Animal(size, type) { 02 this.type = type || 'Animal'; 03 this.canTalk = false; 04 } 05 06 Animal.prototype.speak = function() { 07 if…

Choose your answer, then check it against the explanation.

01 function Animal(size, type) { 02 this.type = type || 'Animal'; 03 this.canTalk = false; 04 } 05 06 Animal.prototype.speak = function() { 07 if (this.canTalk) { 08 console.log("It spoke!"); 09 } 10 }; 11 12 let Pet = function(size, type, name, owner) { 13 Animal.call(this, size, type); 14 this.size = size; 15 this.name = name; 16 this.owner = owner; 17 } 18 19 Pet.prototype = Object.create(Animal.prototype); 20 let pet1 = new Pet(); Given the code above, which three properties are set for pet1?
Answer options
Question 4 of 25

Keep practicing

Take the free JS-Dev-101 practice test

Ten exam-style questions with answers and explanations, plus the exam facts and study guides.

Start the free practice test

More questions

Other JS-Dev-101 practice questions

Scroll to Top