Maybe this was asked before, and I have no clue how to look for it, so I applogize in advance for my total lack of wording skills. So, here it goes. I am programming in ECMA5 (so no fancy array/object methods available). I have one array, which contains the keys, lets say:
var keys = ["name", "age", "school"];
Then, an array of arrays containing the values:
var values = [["John John", 16, "Saints Hills High School"], ["Miranda Knobs", 12, "St Mary Junior High"], ["Patricia Lee", 13, "Milwakee High School"]];
I want to create an array of objects. Each object having the keys from the first array and the values from the second array, like so:
var result = [{name: "John John", age: 16, school: "Saints Hills High School"}, {name: "Miranda Knobs", age: 12, school: "St Mary Junior High"}, {name: "Patricia Lee", age: 13, school: "Milwakee High School"}];
I saw some questions/solutions with 2 arrays, one containing the keys and one the values, but I have no idea how to repeat the first array multiple times for each object.