Would I like to create a new array from the following :
Let array1 = [a,b,c,d]
let array2 = [x, y]
How to get new array like this [ay,bx,cy,dx]?
Thanks,
You could take the index with an offset and the remainder of the length of the second array.
let array1 = ['a','b','c','d'],
array2 = ['x', 'y'],
result = array1.map((v, i) => v + array2[(i + 1) % array2.length]);
console.log(result);
result = array1.map((v, i) => parseInt(v) * parseInt( array2[(i) % array2.length] ));