title: How to get an array with all the possible permutations of n elements of another array?
body: <p>I started studying not so long ago [this is actually my first post] but I decided to try a little side project in javascript and I encountered this challenge.</p>
  <p>I have an array with 7 elements right now, but i plan to change its length in the future. I need another array with all the possible combinations of N elements of the first array.</p>
  <p>So far I could only find a way to get all combinations (N = firstArray.length-1), but haven't had any luck with a lower N.</p>
  <p>Can anyone shed some light? Thanks!</p>