Given the array below
[
{ name: '4K UHD', commentator: 'Ali' },
{ name: 'English 1 HD', commentator: 'Ahmed' },
{ name: 'English 3 HD', commentator: 'Ahmed' },
{ name: 'Premium 1 HD', commentator: 'Ali' },
{ name: 'Premium 2 HD', commentator: 'Ahmed' },
]
I need to organize it so that objects with a name
containing Premium are at the beginning in ascending order.
The expected output is as follows
[
{ name: 'Premium 1 HD', commentator: 'Ali' },
{ name: 'Premium 2 HD', commentator: 'Ahmed' },
{ name: '4K UHD', commentator: 'Ali' },
{ name: 'English 1 HD', commentator: 'Ahmed' },
{ name: 'English 3 HD', commentator: 'Ahmed' },
]
// or like this
[
{ name: 'Premium 1 HD', commentator: 'Ali' },
{ name: 'Premium 2 HD', commentator: 'Ahmed' },
{ name: 'English 1 HD', commentator: 'Ahmed' },
{ name: 'English 3 HD', commentator: 'Ahmed' },
{ name: '4K UHD', commentator: 'Ali' },
]