0👍
Here is a possible and short solution to give you an idea:
const movies = [{genre_ids: [1,2]}, {genre_ids: [2]}, {genre_ids: [1,3]}];
const genres = [{id: 1, name: "genre1"}, {id: 2, name: "genre2"}, {id: 3, name: "genre3"}];
const moviesWithGenres = movies.map(movie => ({
...movie,
genres: genres.filter(({ id }) => movie.genre_ids.includes(id))
}));
Source:stackexchange.com