diff --git a/index.js b/index.js index 9b48491..687229a 100644 --- a/index.js +++ b/index.js @@ -15,25 +15,39 @@ console.log('🚀 It Works!'); // 📝 TODO: Number of filming locations // 1. Make the function return the number of filming locations function getFilmingLocationsNumber () { - return '' + return new Set(filmingLocations).size; } -console.log(`There is ${getFilmingLocationsNumber()} filming locations in Paris`) +//console.log(`There is ${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 compare (a, b) +{ + return new Date(b.fields.date_debut) - new Date(a.fields.date_debut) ; +} function sortFilmingLocationsByStartDate () { - return '' + return filmingLocations.sort(compare); } -console.log(``) +/*let a =sortFilmingLocationsByStartDate() +console.log(a[0]) +console.log(a[a.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 a = 0 + for (let i=0;i