Below is an example of sorting an array:
let arr = ['100.12', '100.8', '100.11', '100.9'];
When sorted traditionally, the output is:
'100.11', '100.12', '100.8', '100.9'
However, I want it to be sorted like page numbers:
'100.8', '100.9', '100.11', '100.12',
EDIT: While there are some solutions available, they lack accuracy in certain cases such as this one:
arr1 = ['100.12', '77.8', '88', '77.11', '77.12', '77.9', '77', '119', '120', '100.8', '100.11', '100', '100.9']
The result would look like:
["77.8", "77.9", "77.11", "77.12", "77", "88", "100.8", "100.11", "100.12", "100", "100.9", "119", "120"]
What is expected should look like:
[ "77", "77.8", "77.9", "77.11", "77.12", "88", "100", "100.8", "100.11", "100.12", "100.9", "119", "120"]