i have these 3 array
[
{ animals: 'dog', user_id: 12, y: 1 },
{ animals: 'cat', user_id: 1, y: 3 }
]
[
{ Habitation: 'Appartement', user_id: 1, y: 1 },
{ Habitation: 'Mansion', user_id: 12, y: 1 },
{ xHabitation: 'House', user_id: 1, y: 2 }
]
[
{ device : 'computer', user_id: 1, y: 1 },
{ device : 'laptop', user_id: 1, y: 2 },
{ device : 'tablet', user_id: 12, y: 1 }
]
So these 3 array have something in common : user_id
And i want to create something like this
[
1 = {
pets : [{ x: 'cat', y: 3 }],
house: [{ x: 'Appartement', y: 1 }, { x: 'House', y: 2 }],
device: [{ x: 'computer', y: 1 }, { x: 'laptop', y: 2 }]
},
12 = {
pets : [{ x: 'dog', y: 1 }],
house: [{ x: 'Mansion', y: 1 }],
device: [{ x: 'tablet', y: 1 }]
}
]
As you can see object are created based on user_id, i dont see/know how to perform a clean code for that in native javascript
Thanks