-
Notifications
You must be signed in to change notification settings - Fork 15.8k
Objects and Object Constructors: Improve clarity of prototype explanations #30437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Objects and Object Constructors: Improve clarity of prototype explanations #30437
Conversation
Existing explanation was incorrect - `.[[Prototype]]` is not valid JS syntax. `[[Prototype]]` is just another way to refer to the internal prototype in text. Link text label made sufficiently accessible on its own.
Common syntax in docs and clearer distinction from `Function.prototype.prototype`
Very common confusion that .prototype is for accessing [[Prototype]]
javascript/organizing_your_javascript_code/objects_and_object_constructors.md
Outdated
Show resolved
Hide resolved
|
Hi @mao-sz , I've missed that you're working on improving the way that prototypes section is written - nice going by the way, I've written what feels like a couple of novels just trying to help couple of learners answer a simple question: When we say prototype, what do we mean? That being said, I hope you don't mind a small point I'd like to bring up - specifically this paragraph:
First sentence is kind of confusing to me, while the second one is, I think, just wrong. Difference is subtle, but important I think - since the way it's worded now, makes it almost seem like Sorry if this is confusing, but I'd really like to see an improvement to the current lesson, and really appreciate you taking charge in making it happen. Edit: Hmm reading fully through the new lesson content, it seems that you've chosen to refer to the concept of a prototype (i.e. an object has a prototype), by calling it |
|
@goran1010 Anyone is allowed to comment on PRs, not just maints. As long as comments are serious of course, and if opinions are shared that it's clear they're opinions/suggestions and not requested changes.
I'm not concerned with there being an unreasonable level of confusion with this first bit because:
Dropping use of The issue with terminology is that "the prototype" is easily misunderstood by learners in this lesson as referring to functions' The use of These changes aim to mostly use the following terms:
|
|
@mao-sz Interestingly MDN docs on Object prototypes do not mention
But, I've also seen cases where it does as you do in the lesson, refer to the Though, I do understand why you want to move away from using the term "prototype" as much as possible - it can mean a thousand different things within the context of this lesson. |
|
Like you said, MDN docs do use But the confusion over the lesson somewhat interchangeably using "prototype" by itself with completely separate concepts, that's both common and unreasonable in the context of our own material, so is worth IMO. |
Was limited in scope and only really addressed something that the lesson now should explicitly and more clearly address.
Better matches section-opening sentence as well as layout style guide
bycdiaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. 🚀
Because
Superseding #29465 due to inactivity.
The topic of constructors and prototypes is a common pain point amongst learners. The most common confusions are the differences between
[[Prototype]],.prototypeand.__proto__and similar, as well as exactly what the lesson is referring to when it just uses the wordprototype.There was also a section with incorrect info (
.[[Prototype]]is not valid JS -[[Prototype]]has a different use).This PR
[[Prototype]][[Prototype]]syntax instead of justprototypespecifically when the lesson is referring to an object's internal prototype.Object.getPrototypeOf()and.prototypeIssue
Closes #28633
Additional Information
Pull Request Requirements
location of change: brief description of changeformat, e.g.Intro to HTML and CSS lesson: Fix link textBecausesection summarizes the reason for this PRThis PRsection has a bullet point list describing the changes in this PRIssuesection