Issue with "Inheritance and the prototype chain": "delete Operator with Object.create and new operator" is mixing up prototypal inheritance and direct assignment #2577
Labels
Content:JS
JavaScript docs
MDN URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain
What information was incorrect, unhelpful, or incomplete?
The section "
delete
Operator with Object.create and new operator" shows different behaviors ofdelete
withObject.create()
andnew
. However, the difference is coming from the fact that thenew
example is directly setting a property (this.vertices = [4, 4];
) in the constructor instead of using prototypal inheritance. It can give an impression that prototypal inheritance behaves differently depending on how to set it up (Object.create()
vsnew
).Specific section or headline?
"
delete
Operator with Object.create and new operator"What did you expect to see?
It would be great to add an example of prototypal inheritance with
new
and show that its behavior withdelete
is the same asObject.create()
.Did you test this? If so, how?
MDN Content page report details
en-us/web/javascript/inheritance_and_the_prototype_chain
The text was updated successfully, but these errors were encountered: