From 7b6c2114fb436f54b85f7adb0fb04e77413cff32 Mon Sep 17 00:00:00 2001 From: Adiman007 Date: Thu, 15 Sep 2022 19:14:11 +0200 Subject: [PATCH 1/5] "TODO 1 done, added function for XY" --- index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 9b48491..abb3020 100644 --- a/index.js +++ b/index.js @@ -15,7 +15,11 @@ console.log('πŸš€ It Works!'); // πŸ“ TODO: Number of filming locations // 1. Make the function return the number of filming locations function getFilmingLocationsNumber () { - return '' + let s1 =new Set() + for (let i=0;ia-b) + console.log(SortedFilm) + return SortedFilm } -console.log(``) +console.log(`newest : ${sortFilmingLocationsByStartDate()[0]} , oldest : ${sortFilmingLocationsByStartDate()[-1]}`) // πŸ“ TODO: Number of filming locations in 2020 only // 1. Make the function return the number of filming locations in 2020 only From 984180c028921fb703ab27738be02de3de222c55 Mon Sep 17 00:00:00 2001 From: Adiman007 Date: Thu, 15 Sep 2022 20:02:56 +0200 Subject: [PATCH 2/5] "latest version" --- index.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index abb3020..6a91a70 100644 --- a/index.js +++ b/index.js @@ -21,25 +21,32 @@ function getFilmingLocationsNumber () { } return s1.size } -console.log(`There is ${getFilmingLocationsNumber()} filming locations in Paris`) +console.log(`There are ${getFilmingLocationsNumber()} filming locations in Paris`) // πŸ“ TODO: Filming locations sorted by start date, from most recent to oldest. // 1. Implement the function // 2. Log the first and last item in array function sortFilmingLocationsByStartDate () { - let SortedFilm = filmingLocations.sort((a.fields,b.fields)=>a-b) - console.log(SortedFilm) + let SortedFilm = filmingLocations.sort(function (a,b){return new Date(b.fields.date_debut) - new Date(a.fields.date_debut)}) return SortedFilm } -console.log(`newest : ${sortFilmingLocationsByStartDate()[0]} , oldest : ${sortFilmingLocationsByStartDate()[-1]}`) +const sortF = sortFilmingLocationsByStartDate() +console.log(sortF[0],sortF[sortF.length-1]) // πŸ“ TODO: Number of filming locations in 2020 only // 1. Make the function return the number of filming locations in 2020 only // 2. Log the result function getFilmingLocationsNumber2020 () { - return '' + let resul =0 + for (let i=0;i Date: Thu, 15 Sep 2022 20:35:54 +0200 Subject: [PATCH 3/5] "latest version" --- index.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6a91a70..69ef53d 100644 --- a/index.js +++ b/index.js @@ -84,15 +84,33 @@ console.log(getFilmingLocationsNumberPerYear()) // } // 2. Log the result function getFilmingLocationsNumberPerDistrict () { - return {} + let locationPerDistrict = {} + + for (let i=0; i Date: Tue, 20 Sep 2022 18:35:10 +0200 Subject: [PATCH 4/5] "latest version" --- index.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index 69ef53d..ae411cf 100644 --- a/index.js +++ b/index.js @@ -104,30 +104,54 @@ console.log(getFilmingLocationsNumberPerDistrict()) // const result = [{film: 'LRDM - Patriot season 2', locations: 12}, {...}] // 2. Log the first and last item of the array function getFilmLocationsByFilm () { - let locationPerFilm = [] - for (let i=0; i Date: Tue, 20 Sep 2022 19:03:35 +0200 Subject: [PATCH 5/5] "latest version" --- index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ae411cf..aa4def5 100644 --- a/index.js +++ b/index.js @@ -219,9 +219,21 @@ console.log(getFilmingLocationsPerFilm(favoriteFilms)) // 1. Implement the function // 2. Log the result function countFilmingTypes () { - return {} + let FilmType = {} + + for (let i=0; i