标签:div nbsp sort var cts pre logs ++ turn
function selectSort(arr) { var len = arr.length; for (var i = 0; i < len -1; i++) { for (var j = i + 1; j < len; j++) { if (arr[i] > arr[j]) { var temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } } return arr; } var arr = [1, 3, 2, 5, 4]; console.log(selectSort(arr)); // [1, 2, 3, 4, 5]
标签:div nbsp sort var cts pre logs ++ turn
原文地址:http://www.cnblogs.com/ax-null/p/6959171.html