I know I can make an algorithm which will sort the array i have but i want to know the best and most optimized way
This is the array i have now i want to sort it according to year so that the values with year 2021 will come first then 2022 and so on after that is done then i want to sort with respect to months so that the final array is like
[
0: {month:'Aug', year:2021},
1: {month:'Jul', year:2022},
2: {month:'May', year:2100},
]
Also my array length will never exceed 12