Last active
May 29, 2016 05:04
-
-
Save nishinoshake/5f36905769911c731631 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 array = [39, 52, 110, 9, 8, 32]; | |
console.log(array); | |
//数値の昇順ソート | |
console.log(array.sort(function(a, b){return a-b;})); | |
//数値の降順ソート | |
console.log(array.sort(function(a, b){return b-a;})); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment