Created
April 10, 2016 14:38
-
-
Save jslnriot/3ee5f03aab5434ca50e41da2e586bdd3 to your computer and use it in GitHub Desktop.
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
numArr = [1,2,4,5,3,6,10,11,5,20,50,33,29]; | |
sortAscending = numArr.sort(function(a,b) { | |
return a - b; | |
}); | |
console.log(sortAscending); | |
sortDescending = numArr.sort(function(a,b){ | |
return b - a; | |
}); | |
console.log(sortDescending); | |
wordArr = ["orange", "apple", "grape"]; | |
sortWordAscending = wordArr.sort(); | |
console.log(sortWordAscending); | |
sortWordDescending = wordArr.reverse(); | |
console.log(sortWordDescending); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment