Skip to content

Commit 87d2b8e

Browse files
authored
Merge pull request #279 from odsantos/update-en-object-keys-values-entries
Update "Object.keys, values, entries" English article
2 parents 48afefa + e67caa4 commit 87d2b8e

File tree

1 file changed

+4
-4
lines changed
  • 1-js/05-data-types/09-keys-values-entries

1 file changed

+4
-4
lines changed

1-js/05-data-types/09-keys-values-entries/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
# Object.keys, values, entries
33

4-
Let's step away from the individual data structures and talk about the iterations over them.
4+
Let's step away from the individual data structures and talk about the iterations over them.
55

66
In the previous chapter we saw methods `map.keys()`, `map.values()`, `map.entries()`.
77

8-
These methods are generic, there is a common agreement to use them for data structures. If we ever create a data structure of our own, we should implement them too.
8+
These methods are generic, there is a common agreement to use them for data structures. If we ever create a data structure of our own, we should implement them too.
99

1010
They are supported for:
1111

@@ -23,7 +23,7 @@ For plain objects, the following methods are available:
2323
- [Object.values(obj)](mdn:js/Object/values) -- returns an array of values.
2424
- [Object.entries(obj)](mdn:js/Object/entries) -- returns an array of `[key, value]` pairs.
2525

26-
...But please note the distinctions (compared to map for example):
26+
Please note the distinctions (compared to map for example):
2727

2828
| | Map | Object |
2929
|-------------|------------------|--------------|
@@ -32,7 +32,7 @@ For plain objects, the following methods are available:
3232

3333
The first difference is that we have to call `Object.keys(obj)`, and not `obj.keys()`.
3434

35-
Why so? The main reason is flexibility. Remember, objects are a base of all complex structures in JavaScript. So we may have an object of our own like `order` that implements its own `order.values()` method. And we still can call `Object.values(order)` on it.
35+
Why so? The main reason is flexibility. Remember, objects are a base of all complex structures in JavaScript. So we may have an object of our own like `data` that implements its own `data.values()` method. And we still can call `Object.values(data)` on it.
3636

3737
The second difference is that `Object.*` methods return "real" array objects, not just an iterable. That's mainly for historical reasons.
3838

0 commit comments

Comments
 (0)