I have two javascript arrays of same size:
let a = [1,2,3,4,5]
let b = [6,7,8,9,10]
I want to merge this in the way:
let out = [1,6,2,7,3,8,4,9,5,10] //no adjecent elements from same array
Currently, I iterate them through a loop:
let a = [1,2,3,4,5]
let b = [6,7,8,9,10]
let out = []
for(let i =0;i<a.length;i++){
out.push(a[i])
out.push(b[i])
}
console.log(out)
Is there a different/ better way to do the merge?