Skip to content

objects iteration part1 done#17

Open
nqgsi wants to merge 1 commit intoJoinCODED:mainfrom
nqgsi:main
Open

objects iteration part1 done#17
nqgsi wants to merge 1 commit intoJoinCODED:mainfrom
nqgsi:main

Conversation

@nqgsi
Copy link

@nqgsi nqgsi commented Jul 22, 2025

No description provided.

@shereengh
Copy link

shereengh commented Jul 23, 2025

function countMoviesByYear(movies: Movie[], year: number): number {
let count = 0;

movies.forEach((movie) => {
if (movie.year) { //need to check here if movie.year === year that is passed in the function parameter
count++;
}
});
return count;
}

function updateMovieGenre(
movies: Movie[],
title: string,
newGenre: string
): Movie[] {
const fmov = movies.find((m) => m.title === title);
if (fmov) {
fmov.genre === newGenre; // you need to assign the new genre not check
}

return movies; // replace empty array with what you see is fit
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants