A constructor adds a field only conditionally, so some instances have an extra property. What hidden-class effect occurs when those instances flow through one access site?
function Point(x, y, flag) {
this.x = x;
this.y = y;
if (flag) this.z = 0; // conditional field
}
function dist(p) { return p.x * p.x + p.y * p.y; }