Skip to content

Commit 6d1785d

Browse files
authored
key values not working in for -of. loop for map
1 parent 98efbc1 commit 6d1785d

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed
Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11

2-
const map = [1, 2 , 3 , 4 , 5];
3-
for(const num of map){
2+
const array = [1, 2 , 3 , 4 , 5];
3+
for(const num of array){
44
console.log(num);
55
}
6+
// Maps
7+
const map = new Map();
8+
map.set('a' , 1);
9+
map.set('b' , 2);
10+
map.set('c' , 3);
11+
map.set('d' , 4);
12+
console.log(map);
13+
14+
/*for(const [key , value] of map){
15+
//console.log(`${key} : ${value}`);
16+
} this doesn't run*/
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+

0 commit comments

Comments
 (0)