-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhomeWork3.js
More file actions
57 lines (46 loc) · 895 Bytes
/
homeWork3.js
File metadata and controls
57 lines (46 loc) · 895 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Задание 1
var x = 0;
while (x < 100) {
x++;
if (x == 1) continue;
if (x == 2 || x == 3 || x == 5 || x == 7) console.log(x);
if (x % 2 == 0) continue;
if (x % 3 == 0) continue;
if (x % 5 == 0) continue;
if (x % 7 == 0) continue;
console.log(x);
}
// Задание 5
var x = "x";
for (var i = 0; i <= 20; i++) {
console.log(x)
x += "x";
}
// Задание 4
for (i = 0; i <= 9; console.log(i++)) { }
// Задача 2 и 3.
var arr = [
{
title: "Товар1",
price: 100,
total: 2
},
{
title: "Товар2",
price: 100,
total: 1
},
{
title: "Товар3",
price: 100,
total: 4
}
]
function countBasketPrice() {
var x = 0;
for (var sum of arr) {
x += (sum.price * sum.total);
}
console.log(x);
}
countBasketPrice();