I have an array of objects that has a few properties in javascript that has a basic structure like so:
{
  id: 123-456
  username: sdfjweihg
}
then I have three, very large arrays that are unsorted, all of them are arrays of objects, but the objects all have all sorts of different matching fields, however they all have an acccount_id that matches the id from the above object.
The above objects also come in an array, so I was doing something like:
let fullUsers = [];
for(let i = 0; i < users.length; i++) {
   fullUser.push({
      user: users[i],
      favorite_movie: moviesOfusers.filter((movie) => movie.account_id === users[i].id),
      favorite_toys: toysOfusers.filter((toy) => toy.account_id === users[i].id),
      favorite_colors: colorsOfUsers.filter((color) => color.account_id === users[i].id)
   )};
}
Where moviesOfusers, toysOfUsers and colorsOfUsers are the arrays that have all sorts of other properties on them, but that matching account_id. It works, and does what I want, but I need something less CPU intensive and faster. If anyone has any suggestions to achieve the same search and attaching that's better I'd love some new ideas. Thank you!
 
     
     
    