Generally, people think that Javascript is not an object-oriented programming language.
Constructor function
function Animal(){
this.feed = function(){
}
}
constructor function automatically sets a prototype object for newly created objects. This prototype object is stored in the ConstructorFunction.prototypeproperty. In constructor function, it stores all the properties and methods in the new object.
The constructor function is JavaScript's version of a class. You'll notice that it has all the features you'd expect in a function but still, it returns nothing. this keyword is basically saying that whenever one of these object instances is created, the object's property will be equal to the name value passed to the constructor call, and the feed() method will use to the constructor call too.
Prototype inheritance
function Animal () {
}
Animal.prototype.feed = function () {
};
The prototype is mechanism which uses to inherits other features, but it works differently than classical inheritance. Prototype acts as a template which inherits properties and how it acts.
Object prototype also has a prototype object which inherits method and properties from core prototype object.
This is called prototype chain. proto the, which is derived from the prototype property on the constructor. In javascript prototype inheritance, it actually does not copy the object, but link is made between the object instance and its prototype
In Prototype inheritance, it creates link or reference of a class to object.
Every object can have another object as its prototype. Then the former object inherits all of its prototype’s properties. An object specifies its prototype via the internal property [[Prototype]].
Please review below reference links which have really a very good description.
https://hackernoon.com/understand-nodejs-javascript-object-inheritance-proto-prototype-class-9bd951700b29
https://www.digitalocean.com/community/tutorials/understanding-prototypes-and-inheritance-in-javascript
https://javascript.info/prototype-inheritance