Hey guys, I’m trying to solve it and know I’m not quite there yet, but looking for some guidance…
Write function named interleave that will take two arrays and interleaves them
Example:
if you pass it ["a", "b", "c"] and ["d", "e", "f"] then it should return ["a", "d", "b", "e", "c", "f"]
NOTE: you can assume each input will be the same length
My code:
function interleave (arr, arr2) {
let newArr = [];
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr2.length; j++) {
newArr.push(arr[i], arr2[j]);
}
}
return newArr;
};