Are you ready for another code challenge? Join me in this video as you test your coding knowledge with the simple quiz questions.
Don't forget to make your guess in the comments below.
-------------------------------------------------------------------------------------------
🔔Like and subscribe for more videos. 🔔
------------------------------------------------------------------------------------------
Answer: OPTION A: 'Rex makes a noise.'
Explanation:
Animal is a constructor function with a method speak on its prototype.
Dog is another constructor function that calls Animal with this context.
Dog.prototype is set to an object created from Animal.prototype, and its constructor is reset to Dog.
When new Dog('Rex') is created and speak is called, it correctly accesses the speak method from Animal.prototype, outputting 'Rex makes a noise.'