Skip to content

Commit

Permalink
👾 smth
Browse files Browse the repository at this point in the history
  • Loading branch information
Rnbsov committed Jun 19, 2022
1 parent d83c401 commit cce703e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 1-js/05-data-types/07-map-set/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ alert( map.get('1') ); // str1
Так что мы можем создать `Map` из обычного объекта следующим образом:
```js
```js run
let obj = {
name: "John",
age: 30
Expand All @@ -174,6 +174,8 @@ let obj = {
*!*
let map = new Map(Object.entries(obj));
*/!*
alert( map.get('name') ); // John
```
Здесь `Object.entries` возвращает массив пар ключ-значение: `[ ["name","John"], ["age", 30] ]`. Это именно то, что нужно для создания `Map`.
Expand Down

0 comments on commit cce703e

Please sign in to comment.