The number of subsets within a set will always be 2 ^ N
, where N
is the length of the set.
const a = [1, 2, 3];
console.log(2 ** 3); // 8
Below is the **power set** of the set `a`, or a representation of all the subsets with the set `a`.
/**
* []
* [1]
* [2]
* [3]
* [1, 2]
* [1, 3]
* [2, 3]
* [1, 2, 3]
*/