Last active
November 27, 2016 18:09
-
-
Save nishinoshake/fc235829fa841da1c5a2 to your computer and use it in GitHub Desktop.
JSでオブジェクトのバリューでソート
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function() { | |
var arr = [ | |
{ | |
'name': 'kimura', | |
'value': 56 | |
}, | |
{ | |
'name': 'kaela', | |
'value': 2 | |
}, | |
{ | |
'name': 'rie', | |
'value': 13 | |
} | |
]; | |
console.log(arr); | |
console.log(arr.sort(function(a, b){return a.value - b.value;})); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment