1
I have two arrays, the first being [a, c, e, g] and the second [b, d, f, h], for example.
I want to concatenate these two arrays into a respective order, forming: [ab, cd, Ef, Gh] instead of the standard Concat, which would be [a, c, e, g, b, d, f, h]. That is, the element of index 0 of the second array, I want it to join element 0 of the first array, and element 1 of the second array, I want it to join element 1 of the first array, so respectfully.
What I tried: Reduce, map and foreach. Because I’m still a beginner in programming logic, I couldn’t get the idea out of the paper.
My code is two inputs. Each array I have shown of example represents the respective values of my inputs (the first array represents the first input and the second, the second). Since the array starts with a blank value, '', because the user who will type its value and display it on the screen, I was unable to perform one for each index, since it is an oscillating array. In a part of the screen, I have a span that will show the value of this new array that I crave.
"What I tried: Reduce, map and foreach" puts in question what already tried
– Ricardo Pontual
What’s the point? I tried and it went wrong '-'
– PiviaN
If I put what I tried I’d have to fill about 30 lines of ugly code
– PiviaN