title: Javascript - Get unique and sorted array
body: <p>I have an array with duplicate items. I want to filter that array to return only unique items, but that items have to be <strong>sorted based on how many times</strong> they were in initial array.</p>
  
  <pre><code>const initialArr = [
    {
      id: 1
    },
    {
      id: 1
    }, 
    {
      id: 2
    },
    {
      id: 1
    },
    {
      id: 3
    },
    {
      id: 3
    },
  ];
  
  const expectedSortedResult = [
    {
      id: 1
    },
    {
      id: 3
    },
    {
      id: 2
    }
  ]
  </code></pre>