// difficulty - 7kyu
// Merge two arrays
// https://www.codewars.com/kata/583af10620dda4da270000c5
const mergeArrays = (a, b) => [
...a.map((v) => {
return b.length ? [v, b.shift()] : [v];
}),
b
].reduce((acc, cur) => acc.concat(cur), []);
// Since ECMA 10th edition(2019) support Array.prototype.flat()
// codewars does not spport ECMA-2019
const mergeArrays = (a, b) => [
...a.map((v) => {
return b.length ? [v, b.shift()] : [v];
}),
b
].flat(1);