Skip to content

Commit

Permalink
no bonuses yet
Browse files Browse the repository at this point in the history
  • Loading branch information
RickyJary committed Oct 1, 2024
1 parent 7761b98 commit a2763fd
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/movies.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,32 @@ function dramaMoviesScore(moviesArray) {
console.log(dramaMoviesScore(movies))

// Iteration 5: Ordering by year - Order by year, ascending (in growing order)
function orderByYear(moviesArray) {}
function orderByYear(moviesArray) {
return [...moviesArray].sort((a, b) => {
if(a.year === b.year){
return a.title.localeCompare(b.title)
}
return a.year - b.year
})
}


// Iteration 6: Alphabetic Order - Order by title and print the first 20 titles
function orderAlphabetically(moviesArray) {}
function orderAlphabetically(moviesArray) {
return moviesArray.map((movie) => {
return movie.title
}).sort((a,b) => {
return a.localeCompare(b);
}).slice(0,20)
}

console.log(orderAlphabetically(movies))
// BONUS - Iteration 7: Time Format - Turn duration of the movies from hours to minutes
function turnHoursToMinutes(moviesArray) {}
function turnHoursToMinutes(moviesArray) {
const timeToMinutes = moviesArray.map((movie) => {
movie.duration
})
}

// BONUS - Iteration 8: Best yearly score average - Best yearly score average
function bestYearAvg(moviesArray) {}

0 comments on commit a2763fd

Please sign in to comment.