I am working with two arrays that have the same length:
One is a simple array
numbers = [4,5,6]
The other is an array of objects
objects = [
{type: "x", value: 7},
{type: "y", value: 8},
{type: "z", value: 9}
]
My goal is to combine these two arrays into a new array. I want to take the values from the first array and assign them keys as 'item', while combining all the types as shown below:
result = [
{item: 4, type: "x"},
{item: 5, type: "y"},
{item: 6, type: "z"},
]