function joinArrayOfArrays(arr) {
var startingArray = arr[0];
var newArray = [];
for(var i=0; i<arr.length; i++) {
newArray = startingArray.concat(arr[i]);
}
return newArray;
}
var output = joinArrayOfArrays([[1, 4], [true, false], ['x', 'y']]);
console.log(output); // --> [1, 4, true, false, 'x'
I want to loop through a for loop and using the concat() method and compile the results in single array. I cannot figure it out Any help?