I have the following Array X = [1,3,5]
and Y = ["X", "Y", "Z"]
.
I need to generate output that looks like this {1:X}, {3:Y}, {5:Z}
I try this code
var X = [1,3,5];
var Y = ["X", "Y", "Z"];
var myArray = [];
for (i = 0; i < X.length; i++) {
myArray.push({ i : Y[i] });
};
But that code generates a Y array without X array What jQuery code should I do to make it work?