Initially I assigned function object to variable Person. At this moment, Person's proto is pointing to Function.prototype. Then I added some functions to Person.prototype. When I call Person constructor with new keyword below and assign it to var test, as far as I know, it sets test proto to Person.prototype. This Person.prototype is an object, with getName mapped to a function. So when I call test.getName(), it searches for the function in test.prototype and if it doesn't find it there, then it will search for the function in its proto i.e. Person.prototype.
Now suppose I create another function object and assign it to variable Customer. It's proto would be pointing to Function.prototype. Then for inheritance we should do Customer.prototype = new Person(). I am confused about why I should do this? Does it sets Customer's proto to Person.prototype. If it does , then shouldn't I just write Customer = new Person(). If it doesn't than, do Customer proto still points to Function.prototype or is there something else that I am missing ?
var Person = function(name) {
this.name = name;
console.log("Running the constructor of Person " + name)
}
Person.prototype.getName = function() {
return this.name;
}
var test = new Person("Yolo");
console.log(Person.prototype.getName.call(test))
console.log(test.getName());
var Customer = function(name) {
this.name = name;
console.log("Running the constructor of Customer " + name)
};
Customer.prototype = new Person();
Thanks in advance !

var test = new Person()andvar Test.prototype = new Person()