var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return b-a});


var status = new Array();
status.push({name: 'BOB', val: 10});
status.push({name: 'TOM', val: 3});
status.push({name: 'ROB', val: 22});
status.push({name: 'JON', val: 7});
status.sort(function(a,b) {
    return a.val - b.val;
});





http://hangaebal.blogspot.kr/2014/06/javascript-array-sort.html
http://www.w3schools.com/jsref/jsref_sort.asp
http://stackoverflow.com/questions/12788051/how-to-sort-an-associative-array-by-value

'Blogger 이사' 카테고리의 다른 글

[JavaScript] String Object Methods  (0) 2016.01.14
[SQL] SQL get last row  (0) 2016.01.14
[Javascript] key value Array  (0) 2016.01.14
[jQuery] jQuery 이벤트 호출  (0) 2016.01.14
[Javascript] window.load vs document.ready  (0) 2016.01.14

+ Recent posts