[Vuejs]-Compare two arrays of object with same values and chenge/add a property of one array to the other one in Vue.js2

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))
  }));

Leave a comment