望大神解答~谢谢
Function.prototype为函数对象原型
function fun(){
}
Function.prototype.isPrototypeOf(fun);//true
Array.prototype.isPrototypeOf(fun);//false
Array.prototpye数组对象原型
Array.prototype.isPrototypeOf([]);//true
Array.prototype.isPrototypeOf(fun);//false
Object.prorotype对象原型对象
Object.prototype.isPrototypeOf(fun);//true
Object.prototype.isPrototypeOf([]);//true
Object.prototype.isPrototypeOf({});//true
拥有不同的方法和属性,Function.prototype, Array.prototype
等的__proto__
都是指向Object.prototype
。
所以说Function.prototype, Array.prototype
等都是可以访问Object.prototype
的属性和方法。
比较有趣的几个demo
Object instanceof Function
true
Function instanceof Object
true
prototype这个属性,往简单理解就是:所有实例对象需要共享的属性和方法都放在这个属性里面.
可参考: http://.com/q/1010000002736664