Skip to content

Instantly share code, notes, and snippets.

@mistadikay
Created March 30, 2015 06:43
Show Gist options
  • Save mistadikay/fce00cddffd14d1021f4 to your computer and use it in GitHub Desktop.
Save mistadikay/fce00cddffd14d1021f4 to your computer and use it in GitHub Desktop.
var selectionSort = function (a) {
for (let i = -1; ++i < a.length;) {
for (let m = j = i; ++j < a.length;) {
if (a[m] > a[j]) m = j;
}
a[m], a[i] = a[i], a[m];
}
return a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment