我知道一般情况下函数都是Function的实例,例如:由function关键字定义的函数,一些内置函数,Array、Number、String、Object、Function等等。还知道每一个函数都有一个prototype属性,一般情况下,fn.prototype都是对象,但有个特例Function.prototype
var fn=function () {
console.log('hello')
}
fn instanceof Function //true
Array instanceof Function //true
Object instanceof Function //true
Function instanceof Function //true
typeof fn.prototype //"object"
typeof Array.prototype //"object"
typeof Object.prototype //"object"
但是typeof Function.prototype // "function"
既然是函数,这个函数也是Function创造的吗?
Function.prototype instanceof Function //false
Function.prototype这个函数为啥没有prototype属性?不是每个函数都有吗?
在chrome控制台打印Function.prototype是一个匿名函数,想知道这个匿名函数是怎么来的?
相关分类