I have an array of strings, which are all similar except for parts of them, eg:
["1234 - Active - Workroom",
"1224 - Active - Breakroom",
"2365 - Active - Shop"]
I have figured out that to sort by the ID number I just use the JavaScript function .sort()
, but I cannot figure out how to sort the strings by the area (eg: "Workroom etc..").
What I am trying to get is:
["1224 - Active - Breakroom",
"2365 - Active - Shop",
"1234 - Active - Workroom"]
The "Active" part will always be the same.
From what I have found online, I have to make a .sort()
override method to sort it, but I cannot figure out what I need to change inside the override method.