title: Howto delete every second and third element from an array?
body: <p>I want to delete every second and third element from an array in Javascript.</p>
  
  <p>My array looks like this:</p>
  
  <pre><code>var fruits = ["Banana", "yellow", "23", "Orange", "orange", "12", "Apple", "green", "10"];
  </code></pre>
  
  <p>Now I want to delete every second and third element. The result would look like this:</p>
  
  <pre><code>["Banana", "Orange", "Apple"]
  </code></pre>
  
  <p>I tried to use a for-loop and splice:</p>
  
  <pre><code>for (var i = 0; fruits.length; i = i+3) {
      fruits.splice(i+1,0);
      fruits.splice(i+2,0);
  };
  </code></pre>
  
  <p>Of course this returns an empty array because the elements are removed while the loop is still executed.</p>
  
  <p>How can I do this correctly?</p>