typeof 与 constructor 返回值
var a = function(){}
typeof (a) === "function" //-->true
a.constructor === Function; //-->true
函数a是Function的一个实例,所以 a.constructor是指向Function,这里不是字符串类型,是Function引用类型。
typeof 就没什么好说的了,返回值永远是字符串。
这里需要注意。
var a = function(){}
typeof (a) === "function" //-->true
a.constructor === Function; //-->true
函数a是Function的一个实例,所以 a.constructor是指向Function,这里不是字符串类型,是Function引用类型。
typeof 就没什么好说的了,返回值永远是字符串。
这里需要注意。