あなたは多くの方法でJavaScriptでオブジェクトを作成することができますどのバージョンから、IEはObject.create(null)をサポートできますか?
// 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)
方法をサポートしているか分からないのですか?
そして、何 –
@Matias、プロトタイプを持たないオブジェクトを持っていたいと思いますが、 '{}'や 'new Object() 'でそれを実現することはできません。 ) '。 –
このスクリプト言語のオブジェクトの原型は、因果的にプロポタイプ!:D JavaScriptはOOPではないため、プロトタイプ指向です。 –