title: How to make a sorted array of objects have distinct values
body: <p>Lets say I have the following array of objects:</p>
  <pre><code>let teams = [
    { Name: &quot;Los Angeles Lakers&quot;, Championships: &quot;17&quot; },
    { Name: &quot;Boston Celtics&quot;, Championships: &quot;17&quot; },
    { Name: &quot;Cleveland Cavaliers&quot;, Championships: &quot;01&quot; },
    { Name: &quot;San Antonio Spurs&quot;, Championships: &quot;05&quot; },
  ]; 
  </code></pre>
  <p>I sort the array:</p>
  <pre><code>teams.sort((a, b) =&gt; parseInt(a.Championships).localeCompare(parseInt(b.Championships)));
  </code></pre>
  <p>And so I have:</p>
  <p><a href="https://i.stack.imgur.com/PB5QU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PB5QU.png" alt="enter image description here" /></a></p>
  <p>The thing is now I want to have distinct values for the property <strong>Championships</strong>, so the final result would be (I don't care which final result I will have, I just want to make it work):</p>
  <p><a href="https://i.stack.imgur.com/p4qFk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p4qFk.png" alt="enter image description here" /></a></p>
  <p>Or the following:</p>
  <p><a href="https://i.stack.imgur.com/26q1b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/26q1b.png" alt="enter image description here" /></a></p>
  <p>How can I do it properly?</p>
  <p>Thank you all!</p>