递归处理组合数组
var arr = []
function func(skuarr=[], i, list){
for (let j=0; j<list[i].length; j++) {
if (i<list.length-1) {
skuarr[i] = list[i][j]
func(skuarr, i+1, list)
} else {
// 拓展运算符合并数组
arr.push([...skuarr,list[i][j]])
}
}
return arr
}
const list = [
['黑色','红色','白色'],
['S','M'],
['好','差']
]
console.log(func([],0,list))