showing results for - "sort date according to months in javascript"
Manuel
29 Apr 2019
1var allMonths = ['Jan','Feb','Mar', 'Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
2
3var month = [ "Apr","May","Jun","Oct","Nov","Dec","Jul","Aug","Sep"];
4
5month.sort(function(a,b){
6    return allMonths.indexOf(a) - allMonths.indexOf(b);
7});
8
9// returns  ["Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
10