title: Angular2/Ionic - Find duplicate items in an array and organize them
body: <p>I have one array that contains multiple elements in a JSON array,
  I can access doing by doing <code>category.language</code> (there is also few other elements in the JSON that are accessible for example doing <code>category.name</code>, <code>category.photo</code>, etc)</p>
  
  <pre><code>English, Russian, French, Russian, English
  </code></pre>
  
  <p>What I want to do is to put the duplicates with each other and end-up having:</p>
  
  <pre><code>English, Russian, French
  </code></pre>
  
  <p>Without removing the duplicates, as removing them will also remove other related elements such as <code>category.name</code>... that have other different values.</p>
  
  <p>Currently I am fetching form a REST API, the following is my code:</p>
  
  <p>Page.js</p>
  
  <pre><code>    this.menuPages = {
            pagination: '.swiper-pagination',
            //need to have 1 or more (it should some how dynamic depending on the number of the unique items, i.e. sometimes should 1 slide per view, sometimes 10 slides per view )
            slidesPerView: '1',
            paginationClickable: true,
            paginationBulletRender: function (index, className) {
            console.log('print now2 : '+storeCategory[index]); 
            return '&lt;span class="' + className + '"&gt;' + storeCategory[index] + '&lt;/span&gt;';
            }
        }
  </code></pre>
  
  <p>Page.html</p>
  
  <pre><code>  &lt;ion-slides pager [options]="Pages"&gt;
            &lt;ion-slide *ngFor="#category of categories"&gt;   
       //put the duplicates with each other, to have one element or more in every slide(page)
            &lt;ion-row&gt;
            &lt;ion-col&gt;
            &lt;div class="title"&gt;{{category.name}&lt;/div&gt;
            &lt;div class="subTitle"&gt;&lt;br&gt;{{category.photo}}&lt;/div&gt;
            &lt;/ion-col&gt;
            &lt;/ion-row&gt;
            &lt;/ion-slide&gt;
      &lt;/ion-slides&gt;
  </code></pre>
  
  <p>I believe playing around either by <code>page.html</code> or <code>page.js</code> should solve the issue! I hope you can suggest some ideas to solve it!</p>