I have the following dynamically generated strings:
var stringA = ["a1", "a2", "a3" ... 'a400' ... 'a600']; // length 600
var stringB = ["b1", "b2", "b3" ... 'b400']; // length 400
How can I get an Array or string of both combined like this:
var myString = ["a1b1", "a2b2", "a3b3" ... "a400b400", "a401" ... "a600"]
You can do something like this:
You can test it out here, the
|| ""is to prevent gettingundefinedas a string on the for the array that’s shorter. TheMath.max()call is to allow eitherAorBto be longer, it’ll iterate to the end of either, just asAis longer in the question.