Category Archives: Javascript

Javascript sort string by last two digit


I have order id with combination of string and alpha characters like “30000-T04”, “30000-T10”, “30000-T05”, “30000-T01”, I want to sort this in ascending order. So let’s see how to do that. To sort an array of strings by the last two digits, you can use the sort() method with a custom comparison function that extracts […]

Read more..