📅  最后修改于: 2022-03-11 15:02:57.593000             🧑  作者: Mango
const getAllSubsets =
theArray => theArray.reduce(
(subsets, value) => subsets.concat(
subsets.map(set => [value,...set])
),
[[]]
);
console.log(getAllSubsets([1,2,3]));