Created
July 27, 2011 03:18
-
-
Save DavidQL/1108592 to your computer and use it in GitHub Desktop.
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
sorted_array = [1,22,13,4,5].sort(function(a, b) { | |
// you get a and b to sort. | |
// if the function returns a.. | |
// negative number: a comes ahead in sort order | |
// a positive number: b comes first | |
return a-b; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment