I have an array of JavaScript objects
let data = [
{ type: 'account', title: 'Robb', subscription: 'ESSENTIAL' },
{ type: 'account', title: 'Bran', subscription: 'ESSENTIAL' },
{ type: 'account', title: 'Arya', subscription: 'FREE' },
{ type: 'article', title: 'The Wall' },
{ type: 'account', title: 'Tyrion', subscription: 'ESSENTIAL' },
];
The array is already sorted. I want to sort it again by subscription. The requirement is to show ESSENTIAL accounts at the top and leave others as they are. Note that some objects does not have a subscription
property.