Suppose I have the below array of integers in JavaScript:
[5,7,6,1,7,5,4,8,2,4]
And I want to create a function that extracts all possible 3 element combinations from it, like below:
[[5,7,6],[5,7,1],[5,7,7],etc]
What is the most performant and shortest way to do it?
Is there a better way to do it than for loops?