这似乎很奇怪。object has no hasOwnProperty method(ie it undefined) - IE8
这里是我的实验在IE8控制台:
typeof obj1 // "object"
obj1.hasOwnProperty // {...}
typeof obj2 // "object"
obj2.hasOwnProperty // undefined
任何想法,这是什么原因?
这似乎很奇怪。object has no hasOwnProperty method(ie it undefined) - IE8
这里是我的实验在IE8控制台:
typeof obj1 // "object"
obj1.hasOwnProperty // {...}
typeof obj2 // "object"
obj2.hasOwnProperty // undefined
任何想法,这是什么原因?
本例来自IE8,但IE6 +和大多数其他IE浏览器的返回值相同。
IE之前#9不限定它主机对象
var o=window;// or document or document elements
o.hasOwnProperty
/* returned value: (undefined)
undefined
*/
是OBJ2一个宿主对象?你在IE7/IE8 /怪癖模式? – Raynos
关于'本地对象和宿主对象之间的区别?':http://stackoverflow.com/questions/7614317/what-is-the-difference-between-native-objects-and-host-objects –
相关http:// stackoverflow.com/questions/135448/how-do-i-check-to-see-if-an-object-has-a-property-in-javascript –