IE从哪个版本开始支持Object.create(null)?

发布于 2024-11-29 10:08:51 字数 578 浏览 1 评论 0原文

在JavaScript中创建对象有很多种方法:

// creates an object which makes the Object, prototype of data.
var data1 = new Object(); 

// Object literal notation; Object still is the prototype of data2.
var data2 = {}; 

// anotherObject is now the prototype of data3.
var data3 = Object.create(anotherObject); 

/* data3 is an object which can be verified bye typeof operator, 
   however, it now has no prototype and you can 
   build everything from scratch. */
var data3 = Object.create(null); 

但我不知道哪些版本的IE支持最后一种方法,即Object.create(null)方法?

You can create an object in JavaScript in many ways:

// creates an object which makes the Object, prototype of data.
var data1 = new Object(); 

// Object literal notation; Object still is the prototype of data2.
var data2 = {}; 

// anotherObject is now the prototype of data3.
var data3 = Object.create(anotherObject); 

/* data3 is an object which can be verified bye typeof operator, 
   however, it now has no prototype and you can 
   build everything from scratch. */
var data3 = Object.create(null); 

But I don't know which versions of IE support the last method, i.e. Object.create(null) method?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满地尘埃落定 2024-12-06 10:08:51

检查维基百科的 JavaScript 版本历史记录。如果您找到 1.8.5 版本 - 并且这是您找到此对象工厂方法可用的语言版本 - Internet Explorer 的第 9 版就是支持该版本的版本。

ECMAScript 5 兼容性表也包含此信息。

您还可以使用 Microsoft 的 IE 虚拟机之一亲自尝试(可从此处 或者,对于非常旧版本的 IE,多个 IE

Check Wikipedia's JavaScript version history. If you find 1.8.5 version - and this is the language version where you find this Object factory method available - 9th version of Internet Explorer is the one supporting that.

The ECMAScript 5 Compatibility Table also has this information.

You can also try for yourself using one of Microsoft's IE virtual machines (available from here or, for very old versions of IE, Multiple IE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文