I am trying to execute a loop and combine 2 arrays, for example, below, I do not know how many values there will be, since the user could buy 1 or 100 products, so he needs to complete the loop.
Array1 = ['ABC', 'DEF', 'GHI']
Array2 = ['123', '45', '6789',]
I need to output:
ABC:123|DEF:45|GHI:6789
I currently have the code ...
function() {
var array_one = ['ABC', 'DEF', 'GHI', 'JKL'];
var array_two = ['179.99', '349.99', '399.99', '389'];
for (var i = 0; i < array_one.length; i++) {
for (var j = 0; j < array_two.length; j++) {
return(array_one[i] + ":" + array_two[j] + "|");
}
}
}
This prints out only one value and does not go in cycles in any ideas where my cycle is interrupted.
source
share