数组排序并插入值算法挑战
function where(arr, num) {
// Find my place in this sorted array.
arr.push(num);
var len = arr.length;
while(len > 0){
for(var j = 0; j < len - 1; j++){
var max = 0;
if(arr[j] > arr[j+1]){
max = arr[j];
arr[j] = arr[j+1];
arr[j+1] = max;
}
}
len --;
}
return arr.indexOf(num);
}
where([40, 60], 50);