-
Notifications
You must be signed in to change notification settings - Fork 0
/
11-exercise.js
53 lines (51 loc) · 1.44 KB
/
11-exercise.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Exercise 11: Use map() and concatAll() to project and flatten the movieLists into an array of video ids
function fn() {
const movieLists = [
{
name: "New Releases",
videos: [
{
id: 70111470,
title: "Die Hard",
boxart: "http://cdn-0.nflximg.com/images/2891/DieHard.jpg",
uri: "http://api.netflix.com/catalog/titles/movies/70111470",
rating: 4.0,
bookmark: []
},
{
id: 654356453,
title: "Bad Boys",
boxart: "http://cdn-0.nflximg.com/images/2891/BadBoys.jpg",
uri: "http://api.netflix.com/catalog/titles/movies/70111470",
rating: 5.0,
bookmark: [{ id: 432534, time: 65876586 }]
}
]
},
{
name: "Dramas",
videos: [
{
id: 65432445,
title: "The Chamber",
boxart: "http://cdn-0.nflximg.com/images/2891/TheChamber.jpg",
uri: "http://api.netflix.com/catalog/titles/movies/70111470",
rating: 4.0,
bookmark: []
},
{
id: 675465,
title: "Fracture",
boxart: "http://cdn-0.nflximg.com/images/2891/Fracture.jpg",
uri: "http://api.netflix.com/catalog/titles/movies/70111470",
rating: 5.0,
bookmark: [{ id: 432534, time: 65876586 }]
}
]
}
];
return movieLists
.map(ml => ml.videos)
.concatAll()
.map(v => v.id);
}