title: Recurse through single array logging all possible combinations in javascript
body: <p>For example, I have an array</p>
  
  <pre><code>["red", "green", "blue", "purple"]
  </code></pre>
  
  <p>There can be any amount of entries in this array.
  Using this array I want to create a list of possible combinations but never duplicating a combination</p>
  
  <p>For example, the above array will result in</p>
  
  <pre><code>red,green,blue,purple
  red,green,purple,blue
  red,blue,green,purple
  red,blue,purple,green
  red,purple,blue,green
  red,purple,green,blue
  
  green,red,blue,purple
  green,red,purple,blue
  green,blue,red,purple
  green,blue,purple,red
  green,purple,blue,red
  green,purple,red,blue
  
  blue,red,green,purple
  blue,red,purple,green
  blue,green,red,purple
  blue,green,purple,red
  blue,purple,green,red
  blue,purple,red,green
  
  purple,red,green,blue
  purple,red,purple,blue
  purple,green,red,blue
  purple,green,blue,red
  purple,blue,green,red
  purple,blue,red,green
  </code></pre>
  
  <p>I am new to recursion and I havent quite gripped how to accomplish this with it,</p>