Skip to content

Instantly share code, notes, and snippets.

@afreeland
Created August 7, 2013 15:09
Show Gist options
  • Save afreeland/6174911 to your computer and use it in GitHub Desktop.
Save afreeland/6174911 to your computer and use it in GitHub Desktop.
JavaScript: Basic Sort Function
// Sorts array elements in ascending order numerically.
function CompareForSort(first, second)
{
if (first == second)
return 0;
if (first < second)
return -1;
else
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment