recently i'm building a small web-app and i have an array of objects such as
[
{
id: '3',
semester: 'summer freshman',
rating: '10'
},
{
id: '4',
semester: 'spring freshman',
rating: '9.5'
},
{
id: '5',
semester: 'fall freshman',
rating: '10'
}
]
, how i sort my data in an order such that entries with semester == fall freshman comes first, followed by entries with semester == spring freshman, and finally semester == summer freshman.
In other words, is there a way to sort my array of objects according to the values of the semester property within each object such that it follows this order:
["fall freshman", "spring freshman", "summer freshman", "fall sophomore" ...]
Thank you!!