Created
August 11, 2017 12:04
-
-
Save lucasmarques73/9de49c098c59ba3dd9cef9a3cbe41a6e to your computer and use it in GitHub Desktop.
Ordenar array em ordem crescente utilizando sort()
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
var sortNumber = function(x, y) | |
{ | |
return x - y; | |
}; | |
var nums = [-23,61,18,30,8,-46,69,67,43,617]; | |
nums.sort(sortNumber); | |
console.log(nums); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment