RosettaCodeData/Task/Loop-over-multiple-arrays-s.../JavaScript/loop-over-multiple-arrays-s...

18 lines
351 B
JavaScript

(function (lstArrays) {
return lstArrays.reduce(
function (a, e) {
return [
a[0] + e[0],
a[1] + e[1],
a[2] + e[2]
];
}, ['', '', ''] // initial copy of the accumulator
).join('\n');
})([
["a", "b", "c"],
["A", "B", "C"],
["1", "2", "3"]
]);