Skip to content

Commit 76a091e

Browse files
committed
TODO1-5 & 7-8 & 11
1 parent 277feb2 commit 76a091e

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

index.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,26 @@ function getArseneFilmingLocations () {
104104
}
105105
console.log(getArseneFilmingLocations())
106106

107-
// 📝 TODO 9: Tous les arrondissement des lieux de tournage de nos films favoris
107+
// 📝 TODO 9: Tous les arrondissement des lieux de tournage de nos films favoris (pas fini)
108108
// (favoriteFilms)
109109
// 1. Return an array of all the districts of each favorite films given as a
110110
// parameter. e.g. :
111111
// const films = { 'LRDM - Patriot season 2': ['75013'] }
112112
// 2. Log the result
113113
function getFavoriteFilmsLocations (favoriteFilmsNames) {
114-
return []
114+
/*
115+
let favoriteFilmsLocations = new Map();
116+
for (const item in filmingLocations)
117+
{
118+
if(favoriteFilmsNames.includes(item.fields.nom_tournage))
119+
{
120+
favoriteFilmsLocations.set(item.fields.nom_tournage,item.fields.ardt_lieu);
121+
}
122+
}
123+
124+
return favoriteFilmsLocations
125+
126+
*/
115127
}
116128
const favoriteFilms =
117129
[
@@ -120,6 +132,8 @@ const favoriteFilms =
120132
'Emily in Paris',
121133
]
122134

135+
//console.log(getFavoriteFilmsLocations (favoriteFilms))
136+
123137
// 📝 TODO 10: All filming locations for each film
124138
// e.g. :
125139
// const films = {
@@ -134,9 +148,12 @@ function getFilmingLocationsPerFilm () {
134148
// 1. Implement the function
135149
// 2. Log the result
136150
function countFilmingTypes () {
137-
return {}
138-
}
151+
let filmsNumberType = new Map();
152+
filmingLocations.forEach(x => filmsNumberType.set(x.fields.type_tournage, filmsNumberType.get(x.fields.type_tournage) + 1 || 1))
139153

154+
return filmsNumberType;
155+
}
156+
console.log(countFilmingTypes ())
140157
// 📝 TODO 12: Sort each type of filming by count, from highest to lowest
141158
// 1. Implement the function. It should return a sorted array of objects like:
142159
// [{type: 'Long métrage', count: 1234}, {...}]

0 commit comments

Comments
 (0)