I have multiple arrays, the first one contains the keys, and the others contain the values.
Array[
"name",
"surname",
"city",
"age"
],
Array[
"John",
"Doe",
"San Francisco",
"27"
],
Array[
"Nancy",
"Doe",
"New York",
"15"
],
Array[
"Maria",
"Doe",
"Texas",
"30"
],
And I want to merge the arrays into an object like this:
{
"name": "John"
"surname": "Doe"
"city": "San Francisco"
"age": "27"
},
{
"name": "Nancy"
"surname": "Doe"
"city": "New York"
"age": "15"
},
{
"name": "Maria"
"surname": "Doe"
"city": "Texas"
"age": "30"
}
How can I do it using js as the length, keys and values of the arrays can change.
Object.keys(...)of the first arrayObject.keys()is for objects, why would you use that on an array?