My question is quite similar to this one: Merge keys array and values array into an object in JavaScript
However, I don't seem to find the solution for my example. If I have these two arrays:
const keys = ['x', 'y', 'z'];
const values = [
[0, 1, 2],
[10, 20, 30],
];
How do I combine them into an array of objects, such that would be the expected result?
[
{
x: 0,
y: 1,
z: 2,
},
{
x: 10,
y: 20,
z: 30,
},
]