I am attempting to use .sort()
to sort golf groups by their starting hole. I need the groups to be listed in the following order. 1A, 1B, 2A, 2B so on and so forth.
Currently, this is how I am sorting the data:
<% groups = groups.sort((a, b) => (a.position > b.position && a.letter > b.letter) ? 1 : -1)%>
Please ignore the abnormal HTML tags, this is being implemented in an e.js template
Currently,the groups are displaying like this:
This is far from the order I need and if anybody has any input as to how to help with this it would be greatly appreciated!
Note:
The "position" property is the number (the 1 in the 1A) The "letter" property is the letter (the A in the 1A)