Skip to content
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: Clarify prototype inheritance and Object.setPrototypeOf() usage #29465

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dekr1sh
Copy link
Contributor

@dekr1sh dekr1sh commented Feb 26, 2025

Because

This PR improves the clarity of prototype inheritance. It explains how Object.setPrototypeOf() is equivalent to setting __proto__ or [[Prototype]] and why directly assigning Player.prototype = Person.prototype is incorrect.

This PR

  • Improved explanation of Object.setPrototypeOf() and how it relates to __proto__ / [[Prototype]].
  • Clarified why Player.prototype = Person.prototype is incorrect and why Object.setPrototypeOf() should be used instead.

Issue

Closes #28633

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project curriculum contributing guide
  • The title of this PR follows the location of change: brief description of change format, e.g. Intro to HTML and CSS lesson: Fix link text
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If any lesson files are included in this PR, they have been previewed with the Markdown preview tool to ensure it is formatted correctly
  • If any lesson files are included in this PR, they follow the Layout Style Guide

@github-actions github-actions bot added the Content: JavaScript Involves the JavaScript course label Feb 26, 2025
Copy link
Contributor

@MaoShizhong MaoShizhong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of accidental line breaks have been added?

Single line breaks don't render any differently and new paragraphs need to be separated by a single blank line (i.e. double line break). So the bits you've changed, anything that should be in the same paragraph should be on the same line of text, and anything that should be a separate paragraph should have a single blank line separating them, as opposed to just a line break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content: JavaScript Involves the JavaScript course
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Objects and Object Constructors: setPrototypeOf() not explained properly
2 participants