From 19da94ca40ee78493e19b9b722d551fde386e578 Mon Sep 17 00:00:00 2001 From: Bradley Finney <77649883+takinabradley@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:09:04 -0400 Subject: [PATCH] edit assignment wording so it doesn't feel as if it's the first time the learner is hearing about the `this` keyword --- .../objects_and_object_constructors.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/organizing_your_javascript_code/objects_and_object_constructors.md b/javascript/organizing_your_javascript_code/objects_and_object_constructors.md index 7fe3d5daadf..2a8b1eedf47 100644 --- a/javascript/organizing_your_javascript_code/objects_and_object_constructors.md +++ b/javascript/organizing_your_javascript_code/objects_and_object_constructors.md @@ -273,7 +273,8 @@ If we had used `Object.setPrototypeOf()` in this example, then we could safely e 1. Read up on the concept of the prototype from the articles below. 1. Read the article [Understanding Prototypes and Inheritance in JavaScript](https://www.digitalocean.com/community/tutorials/understanding-prototypes-and-inheritance-in-javascript) from Digital Ocean. This is a good review of prototype inheritance and constructor functions, featuring some examples. 1. To go a bit deeper into both the chain and inheritance, spend some time with [JavaScript.Info's article on Prototypal Inheritance](http://javascript.info/prototype-inheritance). As usual, doing the exercises at the end will help cement this knowledge in your mind. Don't skip them! Important note: This article makes heavy use of `__proto__` which is not generally recommended. The concepts here are what we're looking for at the moment. We will soon learn another method or two for setting the prototype. -1. Take another look at [JavaScript Tutorial's article on the `this` keyword](https://www.javascripttutorial.net/javascript-this/), paying more attention to it's use with constructor functions this time. +1. You might have noticed us using the this keyword in object constructors and prototype methods in the examples above. + 1. [JavaScript Tutorial's article on the `this` keyword](https://www.javascripttutorial.net/javascript-this/) covers how this changes in various situations, including examples with constructor functions and the prototype. @@ -294,4 +295,3 @@ This section contains helpful links to related content. It isn't required, so co - This [`Object.create` method video by techsith](https://www.youtube.com/watch?v=MACDGu96wrA) provides another point of view on how to use `Object.create` to extend objects by setting the prototype. - The first answer on this StackOverflow question regarding [defining methods via the prototype vs in the constructor](https://stackoverflow.com/questions/9772307/declaring-javascript-object-method-in-constructor-function-vs-in-prototype/9772864#9772864) helps explain when you might want to use one over the other. - [Interactive Scrim on objects and object constructors.](https://scrimba.com/scrim/co2624f87981575448091d5a2) -- Check out this video explanation on the [`this` keyword from DevSage](https://www.youtube.com/watch?v=cwChC4BQF0Q) that gives a different perspective on how its context changes, as well as scenarios in which `this` behaves unexpectedly.