@user2004082, you can also try the below code to get the same as you want.
Try it online at http://rextester.com/GUPBC15345.
var arr = [{id: 588, name: "1 ex"},
{id: 592, name: "11 ex"},
{id: 607, name: "2 ex"},
{id: 580, name: "3 ex"},
{id: 596, name: "4 ex"}];
var map = {}
for(var item of arr) {
map[item["name"]] = item;
}
var arr = arr.map(function(item){return item["name"]}).sort(function(a, b){
var a = parseInt(a.split(' ')[0]);
var b = parseInt(b.split(' ')[0]);
return a-b;
}).map(function(name){
return map[name];
})
console.log(arr);
» Output
[ { id: 588, name: '1 ex' },
{ id: 607, name: '2 ex' },
{ id: 580, name: '3 ex' },
{ id: 596, name: '4 ex' },
{ id: 592, name: '11 ex' } ]