Skip to content

Commit 17efd4f

Browse files
committed
JS Club
0 parents  commit 17efd4f

File tree

42 files changed

+1978
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1978
-0
lines changed

1.Підключення/index_1.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script>
11+
alert("Vladyslav Karapetov");
12+
</script>
13+
</body>
14+
</html>

1.Підключення/index_2.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="./script.js"></script>
9+
</head>
10+
<body>
11+
12+
</body>
13+
</html>

1.Підключення/script.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alert("Vladyslav Karapetov");
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="./script.js"></script>
9+
</head>
10+
<body>
11+
12+
</body>
13+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//function add(x, y) {
2+
// return x + y;
3+
//}
4+
5+
var add = function (x, y) {
6+
return x + y;
7+
};
8+
9+
console.log(add(15, 2));

11.Замикання/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
<script src="./script.js"></script>
9+
</head>
10+
<body>
11+
12+
</body>
13+
</html>

11.Замикання/script.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Task 1
2+
/*
3+
4+
function calcSafePS () {
5+
var a = 0;
6+
var b = 0;
7+
var arr = [];
8+
arr[0] = function(newA, newB){
9+
if ((isNaN(parseFloat(newA)) != true) && (isNaN(parseFloat(newB)) != true) && newA > 0 && newB > 0) {
10+
a = newA;
11+
b = newB;
12+
}
13+
};
14+
arr[1] = function () {
15+
return [2 * a + 2 * b, a * b];
16+
};
17+
return arr;
18+
}
19+
20+
var PS = calcSafePS();
21+
PS[0](2, 3);
22+
console.log(PS[1]());
23+
24+
PS[0](-2, 12);
25+
console.log(PS[1]());
26+
27+
*/
28+
29+
30+
31+
32+
// Task 2
33+
/*
34+
35+
function createArrayIterator(array) {
36+
var i = 0;
37+
return function () {
38+
return array[i++];
39+
}
40+
}
41+
42+
var arr = [5, 3, 7];
43+
var itr = createArrayIterator(arr);
44+
console.log(itr()); // 5
45+
console.log(itr()); // 3
46+
console.log(itr()); // 7
47+
console.log(itr()); // undefined
48+
49+
*/
50+
51+
52+
53+
54+
// Task 3
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="./script.js"></script>
11+
</body>
12+
</html>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function digitSum(k) {
2+
if(k > 0) return k % 10 + digitSum(Math.floor(k / 10));
3+
else if (k == 0) return 0;
4+
else return -1;
5+
}
6+
7+
console.log(digitSum(parseInt(prompt("Enter k: "))));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="./script.js"></script>
11+
</body>
12+
</html>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
function format(data, type) {
2+
if (type == 'number') {
3+
format = function () {
4+
return Number(data);
5+
}
6+
}
7+
else if (type == 'string') {
8+
format = function () {
9+
return String(data);
10+
}
11+
}
12+
else if (type == 'boolean') {
13+
format = function () {
14+
return Boolean(data);
15+
}
16+
}
17+
else return data;
18+
}
19+
20+
var originFormat = format;
21+
22+
format("1", "number");
23+
console.log(format()); // 1
24+
console.log(typeof format()); // "number"
25+
26+
originFormat("Hello", "boolean");
27+
console.log(format()); // true
28+
console.log(typeof format()); // "boolean"
29+
30+
originFormat(true, "string");
31+
console.log(format()); // "true"
32+
console.log(typeof format()); // "string"

14.Об'єкти/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<script src="./script.js"></script>
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)