Set the Child's Prototype to an Instance of the Parent

Tell us what’s happening:
I was wondering is the whole point of this exercise in the practical world; how to work with methods? Why don’t we see a constructor like the following? It won’t even let me even put a this.name = name in the new syntax. Is the new Object.creat() a replacement for that pattern? I must be missing something.

function Tree(name) {
  this.name = name;
}

Your code so far


function Animal() { }

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

function Dog() { }

// Add your code below this line
Dog.prototype = Object.create(Animal.prototype);

let beagle = new Dog();
beagle.eat();  // Should print "nom nom nom"

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/set-the-childs-prototype-to-an-instance-of-the-parent

The point of putting the following line of code:

Dog.prototype = Object.call(Animal.prototype);

is to aid in learning prototype chaining and the broader subject of object inheritance.

The following article by Arnav Aggarwal would help explain the broader subject of why the tutorial is going in this direction of coding.