minor fixes
This commit is contained in:
parent
8db65194dc
commit
8752573cf3
1 changed files with 2 additions and 2 deletions
|
@ -77,7 +77,7 @@ Objects lack many methods that exist for arrays, e.g. `map`, `filter` and others
|
||||||
If we'd like to apply them, then we can use `Object.entries` followed by `Object.fromEntries`:
|
If we'd like to apply them, then we can use `Object.entries` followed by `Object.fromEntries`:
|
||||||
|
|
||||||
1. Use `Object.entries(obj)` to get an array of key/value pairs from `obj`.
|
1. Use `Object.entries(obj)` to get an array of key/value pairs from `obj`.
|
||||||
2. Use array methods on that array, e.g. `map`, to transform key/value pairs.
|
2. Use array methods on that array, e.g. `map`, to transform these key/value pairs.
|
||||||
3. Use `Object.fromEntries(array)` on the resulting array to turn it back into an object.
|
3. Use `Object.fromEntries(array)` on the resulting array to turn it back into an object.
|
||||||
|
|
||||||
For example, we have an object with prices, and would like to double them:
|
For example, we have an object with prices, and would like to double them:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue