Commit f4bbd454 by Artak Yenokyan

Merge branch 'js_49' into 'master'

exercise49.js See merge request bpcarm/trainings2017!1174
parents 09e84742 f3ac7baf
Pipeline #21263858 failed with stage
in 1 minute 52 seconds
$(document).ready(function () {
"use strict";
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));
});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>exercise 49</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="exercise49.js"></script>
</body>
</html>
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