Created
April 10, 2016 17:21
-
-
Save tonylea/2756b19f343c5df747126dbf55984010 to your computer and use it in GitHub Desktop.
Sort array of numbers correctly
This file contains 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 sortNumber(a,b) { | |
return a - b; | |
} | |
var numArray = [140000, 104, 99]; | |
numArray.sort(sortNumber); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment