问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/7023255/from-which-version-ie-can-support-object-createnull