__PROTO__: Properties for all objects.
var obj =//{}varnew//{}var function//[Function:empty]
Prototype: A property in a function object.
var obj = {}; var function () {};console.log (func.prototype); // {}//undefined
The root of all objects is Object,object __proto__ is null
var obj =//{}//nullvarfunction // [Function:empty] // {}Console.log (func.__proto__.__proto__.__proto__); // NULL
An object that is __proto__ to the prototype of the constructor by using the constructor to create the object
var function = ' F1 '//{name: ' F1 '}varnew//{name: ' F1 '}//true
When implementing inheritance, __proto__ points to: Dog1 Instance->dog.prototype->animal.prototype->object->null
functionAnimal () {}animal.prototype.name= ' Animal ';functionDog () {}dog.prototype=NewAnimal ();D og.prototype.height= 10;
Console.log (Animal.prototype); {Name: ' Animal '}
Console.log (Dog.prototype); {Height:10}varDog1 =NewDog (); Console.log (DOG1);//{}Console.log (dog1.__proto__);//{height:10}Console.log (dog1.__proto__.__proto__);//{name: ' Animal '}Console.log (dog1.__proto__.__proto__.__proto__);//{} objectConsole.log (dog1.__proto__.__proto__.__proto__.__proto__);//NULL root
Console.log (Dog1.name); Animal
Console.log (Dog1.height); 10
Well, just learning JavaScript, I think about that so much for a moment.
JavaScript Prototype Memo