I'm trying to write a function in javascript that can devide x elements over y elements in every possible combination. I included a picture of what I want to achieve. It's some basic brute force I guess, but I can't figure out how I should write the loops. I hope somebody can help me. Thanks in advance
for the code. I don't have much yet, because what I tried didn't work.
But I have a globaly defined empty array which is X long. And I have another array full of THE SAME elements and want every combination of the array of length X containing the elements of array with length Y.