<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <title></title> <Scripttype= "Text/javascript"> /*function Person (name) {this.name = name}*/ var Person= function(name) { This. Name=name; }; Person.prototype.getName= function(){ return This. Name; }; varOPerson01= NewPerson ('Fengyouqi'); Operson01.getname (); /** JS in the creation of objects (whether ordinary objects or function objects), there is a built-in property called _proto_, which is used to point to the prototype object of the function object that created it prototype * Console.log (operson01.__p roto__ = = = Person.prototype)//true **/Console.log (operson01.__proto__===Person.prototype); //true /** Similarly, the Person.prototype object also has the _proto_ property, which points to the prototype * Console.log (object) of the function object that created it (Person.prototype.__pro to__ = = = Object.prototype)//true **/Console.log (person.prototype.__proto__===Object.prototype); //true /** Continue, Object.prototype object also has _proto_ property, but it is more special, NULL * Console.log (OBJECT.PROTOTYPE.__PROTO__)//null * */Console.log (object.prototype.__proto__); //NULL /** This chain that has _proto_ string up until Object.prototype._proto_ is called the prototype chain **/ </Script></Head><Body></Body></HTML>
Reference:
http://blog.csdn.net/i10630226/article/details/48689561
Http://www.cnblogs.com/dolphinX/p/4385862.html
Http://www.ruanyifeng.com/blog/2011/06/designing_ideas_of_inheritance_mechanism_in_javascript.html
JavaScript prototype chain