I noticed that freezing the prototype of a constructor function had a side effect that basically broke constructor chaining:
function A(x) {
this.x=x;
}
function B(x, y) {
A.call(this, x);
this.y=y;
}
B.prototype = new A();
Object.freeze(B.prototype);
b=new B(1,2)
// I expected b.x to be 1 here but it's undefined
Here is a fiddle to demonstrate the problem:
http://jsfiddle.net/jhpxv20b/2/
Is there a good reason why b.x is undefined at the end?
If this is not a bug, then how come x2 is 1 in the fiddle?