13
Imagine I have two arrays:
var array1 = ['abc', 'def', 'ghi'];
var array2 = ['123', '456', '789'];
I can use the function .concat()
to join both arrays one after the other, example:
array1.concat(array2) // ['abc', 'def', 'ghi', '123', '456', '789']
But how could you interlink the values of the arrays? Is there any Javascript function to join them so that the values of both merge? Example:
array1.intercalate(array2) //['abc', '123', 'def', '456', 'ghi', '789']
Do you want to follow this order anyway? array1, array2, array1, array2... etc
– Randrade
These arrays are always the same size?
– Guilherme Lautert
@Randrade Yes, always this order.
– Kazzkiq
@Guilhermelautert No. One may be smaller than the other.
– Kazzkiq