Created
November 5, 2018 18:19
-
-
Save juanbrusco/8d6a923fbaa7f165d1a32331774500b0 to your computer and use it in GitHub Desktop.
Order Array - Javscript
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 order(arraylist){ | |
return arraylist.sort(this.sortThings); | |
} | |
function sortThings(a, b) { | |
if (a.NOMBRE > b.NOMBRE) { | |
return 1; | |
} else if (a.NOMBRE < b.NOMBRE) { | |
return -1; | |
} else if (a.NOMBRE === b.NOMBRE) { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment