-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloworld.html
More file actions
51 lines (39 loc) · 1.07 KB
/
helloworld.html
File metadata and controls
51 lines (39 loc) · 1.07 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
<script>
let x = [50,250,200,30];
let max = (p1, p2) =>{
if (p1> p2){
return p1;
}else{
return p2;
}
}
let min = (p1, p2) =>{
if (p1> p2){
return p2;
}else{
return p1;
}
}
let sum = (p1, p2) => {
return p1+p2;
}
console.log(x.reduce(max));
console.log(x.reduce(sum));
let names = ["tilman beyer", "jean hubach", "oliver sperling"];
let abc = (p1,p2) => {
if(p1 < p2) { return -1; }
if(p1 > p2) { return 1; }
return 0;
}
let nachnameVorname = (p) => {
return p.split(' ').slice(-1).join(' ') + ", " + p.split(' ').slice(0, -1).join(' ');
}
names.map(nachnameVorname).sort(abc).forEach(elem => console.log(elem));
</script>
</head>
</html>