Javascript Prototype

Every JavaScript object has a prototype. The prototype is also an object.

All JavaScript objects inherit their properties and methods from their prototype.

JavaScript Prototypes
All JavaScript objects inherit the properties and methods from their prototype.

Objects created using an object literal, or with new Object(), inherit from a prototype called Object.prototype.

Objects created with new Date() inherit the Date.prototype.

The Object.prototype is on the top of the prototype chain.

All JavaScript objects (Date, Array, RegExp, Function, ….) inherit from the Object.prototype.

Creating a Prototype
The standard way to create an object prototype is to use an object constructor function:

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
function Person(first, last, age, eye) {
    this.firstName = first;
    this.lastName = last;
    this.age = age;
    this.eyeColor = eye;
}
//adding new property using prototype
Person.prototype.test=(function(){
return "ppppp";
})();
var myFather = new Person("John", "Doe", 50, "blue");
var myMother = new Person("Sally", "Rally", 48, "green");

document.getElementById("demo").innerHTML =
"My father is " + myFather.age + ". My mother is " + myMother.age+" Newly Added property using prototype "+myFather.test; 
</script>

</body>
</html>

Output:
My father is 50. My mother is 48 Newly Added property using prototype ppppp

Details: https://www.w3schools.com/js/js_object_prototypes.asp