This is hard to articulate but hopefully I make sense. Imagine you have an array like so:
firstArray: [
{
firstName: '',
age: null,
gender: null,
preferences: []
}
],
And you would like to update this array with the contents of another (without overriding any of the keys), such as:
const arrayToPushToFirstArray = [{
age: 1,
firstName: "Billy"
gender: "girl"
},
{
age: 2
firstName: "Daniel"
gender: "boy"
}]
And so that firstArray
looks like:
const firstArray = [{
age: 1
firstName: "Billy"
gender: "girl"
preferences: []
},
{
age: 2
firstName: "Daniel"
gender: "boy"
preferences: [],
}]
How would I achieve this?