Replies: 1 comment 13 replies
-
|
The current resolution came from the understanding that there are 2 types of properties (static and on the prototype. It looks like we have 3 types of properties?
Am I right? (Likely not) |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
To start us off, I'll reference some issues that have already arisen regarding this topic:
mdn/content#16325
mdn/content#17610
mdn/content#18188
https://github.com/mdn/content/discussions/5121
The problem that some readers have with JS documentation is that it currently reads as if to claim that instance properties are instead located on the prototype - which is misleading, but not clarified either.
At the most basic level, this is simply incorrect. MDN makes references to "own" properties, we have articles about prototypes and inheritance, and there are methods such as
Object.hasOwn, so if these are shown as on a prototype, but they aren't, then it may very well lead to confusion, thus leading to more issues about this from readers.For example, in the issue that I raised,
Errorclaims thatcauseis on the prototype, yet it's not even necessarily on the instance.The most accurate way to describe it would be "optionally present on the instance," because if
{ cause }is not present in the constructor, then the property isn't even installed onto the object.This issue applies to
Function.{name, length},Error.{message, cause}, and a few others.It seems that the current resolution is to always use
.prototype., see: mdn/content#16325 (comment).May this be reconsidered?
Beta Was this translation helpful? Give feedback.
All reactions