-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
108 lines (96 loc) · 2.3 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import { streamingServices } from './streamingService.js'
import User from './user.js'
const netflix = streamingServices[0]
const amazonePrime = streamingServices[1]
const newUser = new User()
const userSub = newUser.subscribe(netflix)
// Double
const userSub2 = newUser.subscribe(netflix)
console.log(userSub2);
// Views
userSub.watch('Stranger Things')
userSub.watch('Stranger Things')
userSub.watch('Stranger Things')
userSub.watch('Stranger Things')
userSub.watch('Stranger Things')
userSub.watch('Love, Death & Robots')
userSub.watch('Love, Death & Robots')
userSub.watch('Love, Death & Robots')
userSub.watch('Love, Death & Robots')
userSub.watch('Love, Death & Robots')
userSub.watch('Love, Death & Robots')
userSub.watch('Love, Death & Robots')
userSub.watch("Sex Education")
userSub.watch('Squid Game')
userSub.watch('Squid Game')
userSub.watch('Squid Game')
userSub.watch('Squid Game')
// viewings of shows that don't exist
console.log(userSub.watch('Squid'))
console.log(userSub.watch('Just show'))
//
console.log(netflix.getMostViewedShowsOfYear(2019));
//
console.log(netflix.getMostViewedShowsOfGenre("Horror"));
//
console.log(userSub.getRecommendationTrending());
console.log(userSub.getRecommendationByGenre('Horror'));
//
console.log(netflix.shows[0].getDuration());
// Adding an existing show
netflix.addShow({
"name": "Love, Death & Robots",
"type": "Series",
"episodes": [
{
"name": "episode 1"
},
{
"name": "episode 2"
},
{
"name": "episode 3"
}
],
"duration": 35,
"genre": [
"Anthology",
"Science fantasy",
"Adult animation",
"Horror",
"Black comedy"
],
"releaseDate": {
"dayAndMonth": "March 15",
"year": 2019
}
})
// Adding a new show
netflix.addShow({
"name": "The Sandman",
"type": "Series",
"episodes": [
{
"name": "episode 1"
},
{
"name": "episode 2"
},
{
"name": "episode 3"
},
{
"name": "episode 4"
}
],
"duration": 11,
"genre": [
"Fantasy drama",
"Supernatural horror",
"Superhero"
],
"releaseDate": {
"dayAndMonth": "August 5",
"year": 2022
}
})