title: JS array remove side by side duplicate strings
body: <p>I have array, for example:</p>
  
  <pre><code>var arr = ['ab', 'cd', 'cd', 'ef', 'cd'];
  </code></pre>
  
  <p>Now I want to remove duplicates which is side by side, in this example it's at index 1 &amp; 2 (cd).</p>
  
  <p>result must be:</p>
  
  <pre><code>var arr = ['ab', 'cd', 'ef', 'cd'];
  </code></pre>
  
  <p>I tried this code but it's not working:</p>
  
  <pre><code>var uniqueNames = [];
  $.each(arr, function(i, el){
      if($.inArray(el, uniqueNames) === -1) uniqueNames.push(el);
  });
  </code></pre>
  
  <p>but this filters unique and I don't want this.</p>