-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSortieren.js
More file actions
37 lines (27 loc) · 920 Bytes
/
Copy pathSortieren.js
File metadata and controls
37 lines (27 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var fs=require('fs')
var obj = JSON.parse(fs.readFileSync('./data.json','utf8'));
console.log (obj);
console.log("hello");
//console.log(JSON.parse(JSON.stringify(obj)));
console.log ("Arraylänge: " + obj.numbers.length);
var i, j, a, b, pos;
// höchstes Element finden
let again = true;
while (again) {
again = false;
for (j=0; j<obj.numbers.length-1;j++) {
if (obj.numbers[j] <= obj.numbers[j+1]) {
continue;
} else {
let ring = obj.numbers[j];
obj.numbers[j]=obj.numbers[j+1];
obj.numbers[j+1]=ring;
again = true;
}
//console.log (obj )
//console.log('bei Wert '+ j);
//console.log ('Wert ' + obj.numbers[j] + ' auf Position' + j);
};
};
console.log (obj);
console.log('hello')