function selectionSort(arr) {
var min, temp;
for (var outer = 0; outer <= arr.length - 2; ++outer) {
min = outer;
for (var inner = outer + 1; inner <= arr.length - 1; ++inner) {
if (arr[inner] < arr[min]) {
min = inner
}
}
temp = arr[outer];
arr[outer] = arr[min];
arr[min] = temp
}
return arr
}