Hello,
On https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor,
Towards the end of the page, there is an example meant to show an error when changing the constructor, starting with “function
ParentWithStatic()
{}”.
However when I copy it to the console and create an instance, everything works as is, and I encounter no error,
Even though the comment suggests there should be one when calling the method getOffsetByInitialPosition
// error undefined is not a function, since the constructor is Child
Hello @Rony_Gozes
could you share the full code you test
and have a nice day 
Hey, this is the code that works just fine for me:
function ParentWithStatic() {}
ParentWithStatic.startPosition = { x: 0, y:0 } // Static member property
ParentWithStatic.getStartPosition = function getStartPosition() {
return this.startPosition
}
function Child(x, y) {
this.position = {
x: x,
y: y
}
}
Child = Object.assign(Child, ParentWithStatic) // copies over the static members from ParentWithStatic to Child
Child.prototype = Object.create(ParentWithStatic.prototype)
Child.prototype.constructor = Child
Child.prototype.getOffsetByInitialPosition = function getOffsetByInitialPosition() {
let position = this.position
let startPosition = this.constructor.getStartPosition() // error undefined is not a function, since the constructor is Child
return {
offsetX: startPosition.x - position.x,
offsetY: startPosition.y - position.y
}
};
let child = new Child(1,2)
console.log(child.getOffsetByInitialPosition())
i think you are right but let me ask @chrisdavidmills in case i miss something
and have a nice day both of you 