Posts

Showing posts from April 13, 2019

Angular: sorting software versions alphabetically

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box; } 1 I need to alphabetize a list of software versions in Angular from latest to oldest (i.e. 1.10.3.e, 1.9.5.b, 1.7.3, 1.5.1.c). I have been using .sort() which sorts alphabetically but treats the values as a string resulting in any 1.10 version to be sorted after a 1.5 version as it looks at the 1 and 0 independently.I tried doing .sort((a, b) => b - a) and it completely randomized the list rather than sorting it. I have also tried using .slice('.') which does not seem to work. Any ideas? sorting version alphabetical-sort ...