Skip to content

Instantly share code, notes, and snippets.

@carlosalberto
Created March 16, 2015 00:02
Show Gist options
  • Save carlosalberto/e2e727cae71c6353ae95 to your computer and use it in GitHub Desktop.
Save carlosalberto/e2e727cae71c6353ae95 to your computer and use it in GitHub Desktop.
Sample from MDN's Array.sort() with echojs
Reioukyuu:runtime calberto$ ../arr-sort2.js.exe
stringArray: Blue,Humpback,Beluga
Sorted: [ Beluga, Blue, Humpback ]
numberArray: 40,1,5,200
Sorted without a compare function: [ 1, 200, 40, 5 ]
Sorted with compareNumbers: [ 1, 5, 40, 200 ]
numericStringArray: 80,9,700
Sorted without a compare function: [ 700, 80, 9 ]
Sorted with compareNumbers: [ 9, 80, 700 ]
mixedNumericArray: 80,9,700,40,1,5,200
Sorted without a compare function: [ 1, 200, 40, 5, 700, 80, 9 ]
Sorted with compareNumbers: [ 1, 5, 9, 40, 80, 200, 700 ]
Reioukyuu:runtime calberto$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment