1

I have a simple problem that I can't solve:

const array = [0, 1, 2]

output:

[ [0], [0, 1], [0, 1, 2], [1], [1, 2], [0, 2], [2] ]

As you can see my output contain arrays with all possibilities of the first array. How can I do that?

David Thomas
  • 249,100
  • 51
  • 377
  • 410

0 Answers0