Skip to content

Instantly share code, notes, and snippets.

@lucasmarques73
Created August 11, 2017 12:04
Show Gist options
  • Save lucasmarques73/9de49c098c59ba3dd9cef9a3cbe41a6e to your computer and use it in GitHub Desktop.
Save lucasmarques73/9de49c098c59ba3dd9cef9a3cbe41a6e to your computer and use it in GitHub Desktop.
Ordenar array em ordem crescente utilizando sort()
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