-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.html
61 lines (61 loc) · 1.06 KB
/
2.html
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
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
function sum() {
var sum = 0;
for (var i = 0; i < arguments.length; i++) {
sum += arguments[i];
}
return sum;
}
</script>
<script>
function myConcat(a,...b) {
return b.join(a);
}
</script>
<script>
function sum(a){
return function(b) {
return parseInt(a) + parseInt(b);
}
}
</script>
<script>
function filter(arr,func) {
return arr.filter(func);
}
function inBetween(a,b) {
return function(num) {
return num >= a && num <= b;
}
}
function inArray(arr) {
return function(num) {
return arr.indexOf(num) != -1;
}
}
alert(filter(arr,function(a) { return a % 2 == 0 }));
alert(filter(arr,inBetween(3,6)));
alert(filter(arr,inArray([1,2,10])));
</script>
<script>
function Summator() {
this.sum = function sum(a,b) {
return a + b;
}
this.run = function run() {
a = prompt("Введите a");
b = prompt("Введите b");
alert(this.sum(parseInt(a),parseInt(b)));
}
}
new Summator().run();
</script>
</body>
</html>