1.函数对象和普通对象
函数对象:通过new function()创建的;如:
function aa(){}
普通对象:如 var bb=new aa();bb就是普通对象;
注:可以通过firebug看到普通对象里面没有 prototype属性;只有函数对象有
aa.prototype其实是aa()的一个实例,和bb一样
2.__proto__原型链
无论是函数对象还是普通对象都有__proto__;
__proto__指向创建它的函数对象的prototype;
解释:function aa(){}
var bb=new aa();
bb里面的属性__proto__指向的是aa里面prototype;
3.原型链的形成真正靠的是__proto__
实例:function a(){};
a.name="胡";
function b(){};
b.prototype=a;
var c=new b();
alert(c.name)//"胡"
alert(b.name)//undefined
如果把 b.prototype=a;改成 b.prototype=new a();
那么上面2个的结果都是undefined;
参考:http://www.108js.com/article/article1/10201.html?id=1092