Skip to content

Commit c5acfd2

Browse files
committed
End of TP1
1 parent ef742e5 commit c5acfd2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,13 @@ console.log(getLongestDuration())
236236
// 📝 TODO: Compute the average filming duration
237237
// 1. Implement the function
238238
// 2. Log the result
239+
function getAverageFilmDuration(){
240+
let average = 0;
241+
for(let i of filmingLocations){
242+
let time = new Date(i.fields.date_fin)- new Date(i.fields.date_debut);
243+
average += time;
244+
}
245+
average/=filmingLocations.length;
246+
return duration(average);
247+
}
248+
console.log(getAverageFilmDuration())

0 commit comments

Comments
 (0)