Answers for "find all subsets of an array javascript"

0

find all subsets of an array javascript

const getAllSubsets = 
      theArray => theArray.reduce(
        (subsets, value) => subsets.concat(
         subsets.map(set => [value,...set])
        ),
        [[]]
      );

console.log(getAllSubsets([1,2,3]));
Posted by: Guest on July-27-2020

Code answers related to "find all subsets of an array javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language