Commit f3ac7baf by Narek

exercise49.js version 1

parent b37bc0e5
$(document).ready(function () {
"use strict";
var arr = [5, 2, 1, -10, 8];
var arr = [5, 2, 6, -10, -2, 8, 15];
function reverseSort(arr) {
var current = 0;
for (var i = 0; i < arr.length; ++i) {
for (var j = i + 1; j < arr.length; ++j) {
if (arr[j] > arr[i]) {
current = arr[i];
arr[i] = arr[j];
arr[j] = current;
}
}
}
return arr;
}
console.log(reverseSort(arr));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment