title: how to sort array by groups with javascript?
body: <p>I have an Array with 12 Entries. I like to sort them by titles. Many of articles have the same titles, and i could be easy, because title are identical.
  i could be probably 3 or 4 groups at the end.</p>
  
  <p>i have very tiny javascript code, because i dont know if i want to do it with loop or some other way.</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code> var totalGroups = [];
          var actualGroup = [];
  
  var contentarticles = articles.contentarticles,
                  article,
                  $out = $("#articlesOutput");
  
  
                  for (var i = 0; i &lt; contentarticles.length; i++) {
                      if (!article || article.title != contentarticles[i].title) {
                          article = contentarticles[i];
  
                          document.getElementById('articleForNaviTopTitle').innerHTML = article.title;
                          document.getElementById('articleForNaviTopID').innerHTML = article.id;
  
                          var articlesOutput = [
                              '&lt;li&gt;&lt;a href="./certifiedTraining/id=', article.id, '/step=', i + 1, '"&gt;',
                              article.title,
                              '&lt;/li&gt;'
                          ].join("");
                          $out.append(articlesOutput);
                      }
                  }
  // till this point all works fine, and a code above gives results in the image below.
  
  //**Im struggeling right there, how to sort this array by groups?????**
  
  while (article.title(this) == article.title(next))
    {
    code block to be executed
    }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/DgI83.png" alt="enter image description here"></p>