var arr = [10, 10, 3, 2, 5 , 4, 8, 3]; function reSort(arr) {
var temp = 0;
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]) {
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
} function sort(arr) {
var temp = 0;
var len = arr.length;
for(var i =0; i < len - 1; i++) {
for(var j = 0; j < len - i - 1; j++) {
if(arr[j] > arr[j + 1]) {
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
return arr;
}
console.log(reSort(arr));
console.log(sort(arr));