items = [ {id:1, value:3, perc:0.5}, {id:2, value:2, perc:0.3}, {id:3, value:1, perc:0.2} ] items.sort(function (a, b){ return (b.value - a.value) }) Ordenar ascendentemente por perc items.sort(function (a, b) { return (a.perc - b.perc) })
items = [ {id:1, value:3, perc:0.5}, {id:2, value:2, perc:0.3}, {id:3, value:1, perc:0.2} ] items.sort(function (a, b){ return (b.value - a.value) }) Ordenar ascendentemente por perc items.sort(function (a, b) { return (a.perc - b.perc) })