Imagine that I have two arrays:
var array1 = ['abc', 'def', 'ghi'];
var array2 = ['123', '456', '789'];
I can use the .concat()
function to join both arrays one after the other, for example:
array1.concat(array2) // ['abc', 'def', 'ghi', '123', '456', '789']
But how could I get to merge the values of the arrays? Is there any JavaScript function to join them so that the values of both are mixed? Example:
array1.intercalate(array2) //['abc', '123', 'def', '456', 'ghi', '789']