typeof 与 constructor 返回值

var a = function(){}
typeof (a) === "function"   //-->true
a.constructor === Function;  //-->true

函数a是Function的一个实例,所以 a.constructor是指向Function,这里不是字符串类型,是Function引用类型。
typeof 就没什么好说的了,返回值永远是字符串。
这里需要注意。

posted @ 2012-02-03 15:33  潴哥  阅读(392)  评论(0编辑  收藏  举报