Reputation: 1
Is it possible to change the prototype of an object in IE? Chrome and Firefox support the __proto__
attribute for this, but IE doesn't.
Upvotes: 0
Views: 490
Reputation: 26183
Have you considered just setting the prototype like so:
function Vehicle(tires) {
this.tires = tires;
}
function Car(doors) {
this.doors = doors;
}
Car.prototype = new Vehicle(4);
function Coupe(seats) {
this.seats = seats
}
Coupe.prototype = new Car(2);
Upvotes: 0
Reputation: 7197
JavaScript does not allow the prototype of an object to be changed. __proto__
is not a standard property and you should not rely on it.
In general you should use getProtoTypeOf to get the prototype of an object.
Upvotes: 2