-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson1.js
More file actions
96 lines (73 loc) · 1.69 KB
/
lesson1.js
File metadata and controls
96 lines (73 loc) · 1.69 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// 2.12--------------------------
/*
let i=prompt("введите число больше 100");
while (i<100 && i){
i=prompt("введите число больше 100");
}
*/
// prime numbers вывести простые числа от 1 до указанного числа---------------------
const n = prompt('введите число');
let string = '';
out: for (let i = 1; n >= i; i++) {
for (let j = 1; j <= i - 1; j++) if (i % j === 0 && j !== 1) continue out;
string += `${i}, `;
}
alert(string);
// 2.13----------------------
/*
let b=prompt('введите браузер','');
if (b=='edge') alert('ok'); else {
if (b=='opera'||b=='safari') alert('ok good'); else {
alert('we hope ok');
}
}
*/
//-----------------------------------
/*
let number=+prompt('input number between 0 and 3');
switch (number) {
case 0: alert('0'); break;
case 1: alert('1'); break;
case 2:
case 3: alert('2 or 3');
}
*/
// 2.14----------------------------
/*
function checkAge(age) {
return confirm('Родители разрешили?');
}
alert(checkAge());
*/
//------------------------------------
/*
function getMin(a,b) {
return a<b ? a:b;
}
alert(getMin(10,10));
*/
//--------------------------------------
/*
let a = prompt('1 number');
let b = prompt('2 number');
function getDegree(a, b) {
return a ** b;
}
alert(getDegree(a, b));
*/
// 2.15---------------------------------------
/*
function say (d) {
alert(d);
};
alert(say);
*/
// -------------стрелочные функции
/*
let ask = (question, yes, no) => { if (confirm(question)) yes(); else no();};
ask(
'вы согласны?',
()=> alert('yes'),
()=> alert('no')
);
*/