I am trying to sort an object of strings, which would work with the normal sort function, but I am not able to get it working as the strings start with a number:
e.g.:
{ value: "10 items", value: "5 items", value: "100 items", value: "20 items" }
I want to make it ascending, so it becomes:
5 items
10 items
20 items
100 items
I’ve been trying to use:
data.sort((a, b) => a > b ? 1 : -1).map((a) => { return a;}
But that still shows it as:
10 items
100 items
20 items
5 items