您可以通过多种方式在 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)
方法?