Skip to content

Commit 53dacc2

Browse files
committed
note
1 parent 379ed93 commit 53dacc2

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Collection JavaScript goodies
33

44
<img src="https://img.shields.io/badge/JavaScript-Goodies-Blue" alt="JS-Goodies" />
55

6-
🔎 [IIFE](https://github.com/ekaone/JavaScript-Goodies/blob/master/iife.js)
6+
## 🔎 [IIFE](https://github.com/ekaone/JavaScript-Goodies/blob/master/iife.js)
77
```js
88
(function() {
99
// ...
@@ -15,7 +15,15 @@ Collection JavaScript goodies
1515

1616
```
1717

18-
🔎 [Map](https://github.com/ekaone/JavaScript-Goodies/blob/master/map.js)
18+
## 🔎 [Map](https://github.com/ekaone/JavaScript-Goodies/blob/master/map.js)
19+
```js
20+
const obj = { a: 1, b: 2, c: 3 };
21+
22+
// Object.entries
23+
// const result = Object.entries(obj)
24+
const result = Object.entries(obj).map(([key, value]) => [key, value * 2]);
25+
console.log(result);
26+
```
1927

2028
## Author
2129
✔ Eka Prasetia 🤵

map.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44
// { id: 3, city: "Tokyo" },
55
// ]
66

7-
const obj = { a: 1, b: 2, c: 3 }
8-
9-
// a funcbn
10-
// cst result = obj.map(result => result.city)
7+
const obj = { a: 1, b: 2, c: 3 };
118

129
// Object.entries
1310
// const result = Object.entries(obj)
14-
const result = Object.entries(obj).map(([key, value]) => [key, value * 2])
15-
console.log(result)
11+
const result = Object.entries(obj).map(([key, value]) => [key, value * 2]);
12+
console.log(result);
1613

1714
// Object keys
1815
// const result = Object.keys(obj).map(v => obj[v] *= 2)
@@ -24,4 +21,4 @@ console.log(result)
2421

2522
// Object.values
2623
// const result = Object.keys(obj)
27-
// console.log(result)
24+
// console.log(result)

0 commit comments

Comments
 (0)