How can I combine test1 and test2 to get the same result as test? I found concat() and join() can do the combination but can't get the result I want.
var test1 = [1,5,7,4]
var test2 = ["apple","banana","apple","banana"]
var test = [
{xValue:1,yValue:"apple"},
{xValue:5,yValue:"banana"},
{xValue:7,yValue:"apple"},
{xValue:4,yValue:"banana"}
]
console.log(test);
console.log(test1);
console.log(test2);
I have 21 arrays with hundreds of length for each one in my real case. I am trying to combine them together and get the result like the example above. Thanks!!
test1length andtest2length always equal?