JA
Size: a a a
JA
ei
function iteration(acc, head, rest) {
if (head) {
acc.add(head)
}
if (rest.length === 0) {
return
}
const [next, ...nextRest] = rest
for (const item of next) {
iteration(acc, `${head} ${item}`, nextRest)
}
}
function calculateAllCombinations(arrays) {
const acc = new Set()
iteration(acc, '', arrays)
return Array.from(acc)
}
ei
calculateAllCombinations([
['One', 'Two', 'Three'],
['1', '2', '3'],
['-', '+', '=']
])
D
ei
ei
JA
JA
JA
D
D
JA
ei
ei
ei