Last active
December 11, 2015 02:19
-
-
Save derekwyatt/4529947 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
| % node -v | |
| v0.6.12 | |
| % node | |
| > [1,2,3,11,22].sort() | |
| [ 1, | |
| 11, | |
| 2, | |
| 22, | |
| 3 ] | |
| > console.log("That's just awesome") | |
| damn right! | |
| > |
Author
Umm... yeah, but /usr/bin/sort isn't a programming language :) JS should probably understand the difference between [1,2,3,11,22] and ["1","2","3","11","22"].
Fair point.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
now try: [1,2,3,11,22].sort(function(a,b){return a-b});
sort's default behaviour is to do an alphasort. Bash's sort will do the same thing:
cat << HERE | sort