title: Javascript, Given some conditionals, All posible combinations of arrays in an array
body: <p>I have this array:</p>
  <pre><code>[[1, 3, 7][2, 1, 0][2, 5, 4][3, 5, 0][4, 2, 4][4, 5, 7][5, 3, 0][6, 3, 7]]
  </code></pre>
  <p>I want to have all possible combinations of arrays having two conditions:</p>
  <ol>
  <li>That the element 0 is never the same</li>
  <li>That the element 2 is different, without repetition</li>
  </ol>
  <p>My product should be responsive to different inputs of 3 value arrays, and in this case, it should look like this:</p>
  <pre><code>[
  [[1, 3, 7][2, 1, 0][4, 2, 4]]
  [[1, 3, 7][2, 5, 4][3, 5, 0]]
  [[1, 3, 7][2, 5, 4][5, 3, 0]]
  [[1, 3, 7][3, 5, 0][4, 2, 4]]
  ... and so on
  ]
  </code></pre>
  <p>Hope you could understand the issue and give some help.</p>