7
7
<img alt =" Twitter Follow " src =" https://img.shields.io/twitter/follow/asabeneh?style=social " >
8
8
</a >
9
9
10
- <sub >Author:
11
- <a href =" https://www.linkedin.com/in/asabeneh/ " target =" _blank " >Asabeneh Yetayeh</a ><br >
12
- <small > January, 2020</small >
13
- </sub >
10
+ <sub >Author:
11
+ <a href =" https://www.linkedin.com/in/asabeneh/ " target =" _blank " >Asabeneh Yetayeh</a ><br >
12
+ <small > January, 2020</small >
13
+ </sub >
14
+
14
15
</div >
15
16
16
17
[ << Day 9] ( ../09_Day_Higher_order_functions/09_day_higher_order_functions.md ) | [ Day 11>>] ( ../11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md )
@@ -67,7 +68,7 @@ const languages = [
67
68
' French' ,
68
69
' Spanish' ,
69
70
' English' ,
70
- ' French'
71
+ ' French' ,
71
72
]
72
73
73
74
const setOfLangauges = new Set (languages)
@@ -88,7 +89,7 @@ const languages = [
88
89
' French' ,
89
90
' Spanish' ,
90
91
' English' ,
91
- ' French'
92
+ ' French' ,
92
93
]
93
94
94
95
const setOfLangauges = new Set (languages)
@@ -183,7 +184,7 @@ const languages = [
183
184
' French' ,
184
185
' Spanish' ,
185
186
' English' ,
186
- ' French'
187
+ ' French' ,
187
188
]
188
189
const langSet = new Set (languages)
189
190
console .log (langSet) // Set(4) {"English", "Finnish", "French", "Spanish"}
@@ -193,19 +194,19 @@ const counts = []
193
194
const count = {}
194
195
195
196
for (const l of langSet) {
196
- const filteredLang = languages .filter (lng => lng === l)
197
+ const filteredLang = languages .filter (( lng ) => lng === l)
197
198
console .log (filteredLang) // ["English", "English", "English"]
198
199
counts .push ({ lang: l, count: filteredLang .length })
199
200
}
200
201
console .log (counts)
201
202
```
202
203
203
204
``` js
204
- [
205
+ ; [
205
206
{ lang: ' English' , count: 3 },
206
207
{ lang: ' Finnish' , count: 1 },
207
208
{ lang: ' French' , count: 2 },
208
- { lang: ' Spanish' , count: 1 }
209
+ { lang: ' Spanish' , count: 1 },
209
210
]
210
211
```
211
212
@@ -254,7 +255,7 @@ let b = [3, 4, 5, 6]
254
255
let A = new Set (a)
255
256
let B = new Set (b)
256
257
257
- let c = a .filter (num => B .has (num))
258
+ let c = a .filter (( num ) => B .has (num))
258
259
let C = new Set (c)
259
260
260
261
console .log (C )
@@ -276,7 +277,7 @@ let b = [3, 4, 5, 6]
276
277
let A = new Set (a)
277
278
let B = new Set (b)
278
279
279
- let c = a .filter (num => ! B .has (num))
280
+ let c = a .filter (( num ) => ! B .has (num))
280
281
let C = new Set (c)
281
282
282
283
console .log (C )
@@ -306,7 +307,7 @@ Map(0) {}
306
307
countries = [
307
308
[' Finland' , ' Helsinki' ],
308
309
[' Sweden' , ' Stockholm' ],
309
- [' Norway' , ' Oslo' ]
310
+ [' Norway' , ' Oslo' ],
310
311
]
311
312
const map = new Map (countries)
312
313
console .log (map)
@@ -347,7 +348,7 @@ Helsinki
347
348
348
349
### Checking key in Map
349
350
350
- Check if a key exist in a map using * has * method. It returns * true * or * false * .
351
+ Check if a key exist in a map using _ has _ method. It returns _ true _ or _ false _ .
351
352
352
353
``` js
353
354
console .log (countriesMap .has (' Finland' ))
@@ -416,32 +417,35 @@ const countries = ['Finland', 'Sweden', 'Norway']
416
417
417
418
``` js
418
419
// Your output should look like this
419
- console .log (mostSpokenLanguages (countries, 10 ))
420
- [
421
- { ' English ' : 91 },
422
- { ' French ' : 45 },
423
- { ' Arabic ' : 25 },
424
- { ' Spanish ' : 24 },
425
- { ' Russian ' : 9 },
426
- { ' Portuguese ' : 9 },
427
- { ' Dutch ' : 8 },
428
- { ' German ' : 7 },
429
- { ' Chinese ' : 5 },
430
- { ' Swahili ' : 4 },
431
- { ' Serbian ' : 4 } ]
420
+ console .log (mostSpokenLanguages (countries, 10 ))[
421
+ ({ English : 91 },
422
+ { French : 45 },
423
+ { Arabic : 25 },
424
+ { Spanish : 24 },
425
+ { Russian : 9 },
426
+ { Portuguese : 9 },
427
+ { Dutch : 8 },
428
+ { German : 7 },
429
+ { Chinese : 5 },
430
+ { Swahili : 4 },
431
+ { Serbian : 4 })
432
+ ]
432
433
433
434
// Your output should look like this
434
435
console .log (mostSpokenLanguages (countries, 3 ))
435
-
436
- [
437
- {' English' : 91 },
438
- {' French' : 45 },
439
- {' Arabic' : 25 }
440
- ]
441
436
```
442
437
438
+ [
439
+ {'English':91},
440
+ {'French':45},
441
+ {'Arabic':25}
442
+ ]
443
+
444
+ ```
445
+
443
446
444
447
🎉 CONGRATULATIONS ! 🎉
445
448
446
449
447
450
[<< Day 9](../09_Day_Higher_order_functions/09_day_higher_order_functions.md) | [Day 11>>](../11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md)
451
+ ```
0 commit comments