typeof 与 Object.prototype.toString.apply 对待 undefined 的不同

作者:vkvi 来源:ITPOW(原创) 日期:2010-5-22
alert(typeof undefined);
alert(Object.prototype.toString.apply(undefined));

结果为:

undefined
[object Object]

由此看出,在 Object.prototype.toString.apply 眼里 undefined 也是 Object。

而对待 null 的问题上,大家意见都是一致的:

object
[object Object]
相关文章