Skip to content

Commit 662c389

Browse files
authored
Merge pull request #360 from andrej-repisky/patch-1
Fixed incorrect it's/its
2 parents 45a47c0 + c8df40f commit 662c389

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

1-js/04-object-basics/01-object/article.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In contrast, objects are used to store keyed collections of various data and mor
99

1010
An object can be created with figure brackets `{…}` with an optional list of *properties*. A property is a "key: value" pair, where `key` is a string (also called a "property name"), and `value` can be anything.
1111

12-
We can imagine an object as a cabinet with signed files. Every piece of data is stored in it's file by the key. It's easy to find a file by it's name or add/remove a file.
12+
We can imagine an object as a cabinet with signed files. Every piece of data is stored in its file by the key. It's easy to find a file by its name or add/remove a file.
1313

1414
![](object.png)
1515

@@ -472,7 +472,7 @@ As a result we have two independent variables, each one is storing the string `"
472472
473473
Objects are not like that.
474474
475-
**A variable stores not the object itself, but it's "address in memory", in other words "a reference" to it.**
475+
**A variable stores not the object itself, but its "address in memory", in other words "a reference" to it.**
476476
477477
Here's the picture for the object:
478478
@@ -703,7 +703,7 @@ user.sizes.width++; // change a property from one place
703703
alert(clone.sizes.width); // 51, see the result from the other one
704704
```
705705
706-
To fix that, we should use the cloning loop that examines each value of `user[key]` and, if it's an object, then replicate it's structure as well. That is called a "deep cloning".
706+
To fix that, we should use the cloning loop that examines each value of `user[key]` and, if it's an object, then replicate its structure as well. That is called a "deep cloning".
707707
708708
There's a standard algorithm for deep cloning that handles the case above and more complex cases, called the [Structured cloning algorithm](https://w3c.github.io/html/infrastructure.html#internal-structured-cloning-algorithm). In order not to reinvent the wheel, we can use a working implementation of it from the JavaScript library [lodash](https://lodash.com), the method is called [_.cloneDeep(obj)](https://lodash.com/docs#cloneDeep).
709709

0 commit comments

Comments
 (0)