Property of Inherit

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**
function Animal() { }

Animal.prototype = {
constructor: Animal,
eat: function() {
  console.log("nom nom nom");

function Dog() { }

// Only change code below this line

let beagle = new Dog();

you said beagle inherits all of Animal 's properties, including the eat method. But when I log It print undefined ? , why name is not property of beagle ?

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.80 Safari/537.36

Challenge: Set the Child’s Prototype to an Instance of the Parent

Link to the challenge:

Where do you see a name property? Do you mean

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.