fix(curriculum): use example in Modifying an Object Within a Nested Object challenge (#38468)
* fix: use example in modifying an object within a nested object exercise to explain how to do so * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.english.md Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.english.md Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.english.md Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> * Update curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-data-structures/modify-an-object-nested-within-an-object.english.md Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Shaun Hamilton <51722130+Sky020@users.noreply.github.com>
This commit is contained in:
parent
46ef3df532
commit
e10a046f8a
@ -18,18 +18,24 @@ let nestedObject = {
|
||||
online: 80,
|
||||
onlineStatus: {
|
||||
active: 67,
|
||||
away: 13
|
||||
away: 13,
|
||||
busy: 8
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
<code>nestedObject</code> has three unique keys: <code>id</code>, whose value is a number, <code>date</code> whose value is a string, and <code>data</code>, whose value is an object which has yet another object nested within it. While structures can quickly become complex, we can still use the same notations to access the information we need.
|
||||
<code>nestedObject</code> has three properties: <code>id</code> (value is a number), <code>date</code> (value is a string), and <code>data</code> (value is an object with its nested structure). While structures can quickly become complex, we can still use the same notations to access the information we need. To assign the value <code>10</code> to the <code>busy</code> property of the nested <code>onlineStatus</code> object, we use dot notation to reference the property:
|
||||
|
||||
```js
|
||||
nestedObject.data.onlineStatus.busy = 10;
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
Here we've defined an object, <code>userActivity</code>, which includes another object nested within it. You can modify properties on this nested object in the same way you modified properties in the last challenge. Set the value of the <code>online</code> key to <code>45</code>.
|
||||
Here we've defined an object <code>userActivity</code>, which includes another object nested within it. Set the value of the <code>online</code> key to <code>45</code>.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
|
Loading…
x
Reference in New Issue
Block a user