Skip to content

Commit

Permalink
Rephrase "extend" verbiage
Browse files Browse the repository at this point in the history
Original wording could be misinterpreted to mean that Player.prototype
actually is the same object as Person.prototype, instead of inheriting
from it.
  • Loading branch information
MaoShizhong committed Nov 28, 2024
1 parent eb415d8 commit 5b5c566
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion javascript/organizing_your_javascript_code/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This section contains a general overview of topics that you will learn in this l
1. Read about [getters and setters](https://javascript.info/property-accessors) (don't worry about the "accessor descriptors" section as we have not covered them before). While the article doesn't show classes yet, classes can use getters and setters via the same syntax (without `Object.defineProperty`).
1. Read JavaScript.info's [primer on class syntax](https://javascript.info/class) for an overview of class syntax.
1. [MDN's docs on classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) are, as usual, a great resource for going a little deeper. There are lots of individual syntax features but these can be explored over time. As usual, you're not required to memorize anything just from reading docs here and now. Some good features to have a little look at include:
- [Extending classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends) (like having a Player class that extends a Person class and inherits from `Person.prototype`).
- [Extending classes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends) (like having a Player class that extends a Person class, adding `Person.prototype` to the prototype chain).
- [Private properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields), allowing you to have properties or methods that are not accessible outside of the class, like with private variables in factory functions.
- [Static properties and methods](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static) which are properties and methods (public or private) that are accessed on the class itself and not on the instance of a class. This is similar to how some string methods are accessed on the instance of a string itself e.g. `someString.slice(0, 5)` whereas some methods are called on the String constructor directly e.g. `String.fromCharCode(79, 100, 105, 110)`.

Expand Down

0 comments on commit 5b5c566

Please sign in to comment.