object没有hasOwnProperty方法(即它未定义) - IE8 [英] object has no hasOwnProperty method (i.e. it's undefined) - IE8

查看:898
本文介绍了object没有hasOwnProperty方法(即它未定义) - IE8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来很奇怪。

这是我在IE8控制台中的实验:

Here's my experiment in the IE8 console:

typeof obj1 // "object"
obj1.hasOwnProperty // {...}

typeof obj2 // "object"
obj2.hasOwnProperty // undefined

关于可能导致此问题的任何想法?

Any ideas as to what could cause this?

推荐答案

此示例来自IE8,但同样的返回来自IE6 +和大多数其他IE浏览器。

This example is from IE8, but the same return is from IE6+ and most other IE browsers.

IE之前#9没有为主机对象定义

IE before #9 does not define it for host objects

var o=window;// or document or document elements
o.hasOwnProperty

/*  returned value: (undefined)
undefined
*/

这篇关于object没有hasOwnProperty方法(即它未定义) - IE8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆