const getCombination = (array) => {
let resultArry = []
array.forEach((arrItem) => {
if (resultArry.length === 0) {
resultArry = arrItem
} else {
const emptyArray = []
resultArry.forEach((item) => {
arrItem.forEach((value) => {
emptyArray.push([item, value])
})
})
resultArry = emptyArray
}
})
return resultArry
}
const a = [
['A', 'B', 'C'],
['C', 'D', 'E'],
]
const b = getCombination(a)
console.log(b)