📜  查找数组的所有子集 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:57.593000             🧑  作者: Mango

代码示例1
const getAllSubsets = 
      theArray => theArray.reduce(
        (subsets, value) => subsets.concat(
         subsets.map(set => [value,...set])
        ),
        [[]]
      );

console.log(getAllSubsets([1,2,3]));