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) })
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter