title: JavaScript Arrays : Keep only values that are present an odd number of times, including once
body: <p>Hey guys so for example I have an array:</p>
  
  <pre><code>myArray[5,4,1,2,1,4,5,6,7,8,9,10,1,2,1,5,3,2]
  </code></pre>
  
  <p>I'm sorting that array:</p>
  
  <pre><code>[1, 1, 1, 1, 10, 2, 2, 2, 3, 4, 4, 5, 5, 5, 6, 7, 8, 9]
  </code></pre>
  
  <p>And I want to delete only the two duplicates so the array I want will be</p>
  
  <pre><code>[10,2,3,5,6,7,8,9]
  </code></pre>
  
  <p>So i'm using splice:</p>
  
  <pre><code>for (var index = 0; index &lt; myArray.length +1; ++myArray) {
    if(myArray[index+1]== myArray[index]) {
      myArray.splice(index);
      myArray.splice[index+1];
    }
  }
  </code></pre>
  
  <p>But when I'm pushing more of the of the numbers, the results seem unpredictable
  How to do this properly?</p>
  
  <p>To clarify: The purpose is to eliminate the numbers which repeat an even number of times. </p>