I have an array like so which i am trying to merge so any object that has the name property the same will after the merge contain a list of merged objects
var array = [
{name: "One",
myList: [Object1, Object2]
},
{name: "Two",
myList: [Object3, Object4]
},
{name: "One",
myList: [Object5, Object6]
}
]
How do i merge the two 'One' objects so i get something like
var array = [
{name: "One",
myList: [Object1, Object2, Object5, Object6]
},
{name: "Two",
myList: [Object3, Object4]
}
]
looking to do this in vanilla javascript
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…