Difference between __proto__ and prototype in Javascript

__proto__

This is actual a Object that is used in the lookup chain to resolve methods.

var person3 = {
	name: 'Max'
}

person3.__proto__

.prototype

This is used to inherit one Object or Function to another Object. when you create an object with new and also this is build __proto__

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

person3.prototype.age = 18

var person4 = new person3('Max')

person4.name

person4.age

person4

[vc_single_image image=”879″ img_size=”full”]

Leave a Reply

Your email address will not be published. Required fields are marked *