I have two arrays like so
var arr1 = ["1", "2", "3", "4"];
var arr2 = [["a", "b", "c", "d"], ["e", "f", "g", "h"], ["i", "j", "k", "l"], ["m", "n", "o", "p"], ["q", "r", "s", "t"]];
What I would like to do is merge the two arrays to form a final output that looks like this
var newArr = [{1: "a", 2: "b", 3: "c", 4: "d"}, {1: "e", 2: "f", 3: "g", 4: "h"}, {1: "i", 2: "j", 3: "k", 4: "l"}, {1: "m", 2: "n", 3: "o", 4: "p"}, {1: "q", 2: "r", 3: "s", 4: "t"}];
So effectively take each array out of the second array and then merge it with the first array to form an object.
I was just wandering what the most efficient way to do this in javascript would be?
Any help would be much appreciated
Thanks for your time
.forEachor.map()to achieve this.zipObjectfunction lodash.com/docs#zipObject