// 选择排序
var arr2 = [35, 5, 34, 4, 12, 3, 44, 2, 43, 6, 8, 0, 122];
console.log(arr2);
function selectSort(arr) {
// arr 进行排序的数组
for (var i = 0; i < arr.length; i++) {
for (var j = i + 1; j < arr.length; j++) {
if (arr[i] > arr[j]) {
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
console.log(arr);
return arr;
}
selectSort(arr2);