Javascript how to sort array of objects by numeric value of the string [duplicate]
问题 This question already has answers here : Sort array of strings by integer (which is the first character) (3 answers) Sort Array Elements (string with numbers), natural sort (8 answers) Closed 2 years ago . Below is an example of my array of objects and I am supposed to sort these by name. The js normal sorting sorts as shown below, however my target is to sort by the numeric value, eg: "1 ex, 2 ex, 3 ex, 4 ex, 11 ex ..". Could someone help me how to achieve this? [{id: 588, name: "1 ex"} {id: