Inherit Behaviors from a Supertype

Tell us what’s happening:
I do not understand this function:

function Animal() { }

Why is it empty?

Your code so far

function Animal() { }

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

// Add your code below this line

let duck; // Change this line
let beagle; // Change this line; // Should print "nom nom nom"; // Should print "nom nom nom" 

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0.

Link to the challenge:

It is just a constructor function which is used to help define the prototype for Animal. In this case it does not need to do anything else, so it is empty. However, it still needs to be a function to work.

1 Like