-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex8.js
79 lines (62 loc) · 1.76 KB
/
ex8.js
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
const commands = {
new: "new",
show: "dupa123",
exit: "exit",
}
const alina = {
name: "Alina",
surname: "Sytnik",
age: 20,
sex: "Female",
country: "Poland",
city: "Warsaw"
}
const maksym = {
name: "Maksym",
surname: "Boytsov",
age: [20, [20, 21]],
sex: "Male",
country: "Poland",
city: "Warsaw"
}
const users = [alina, maksym, alina, maksym, alina, maksym];
// const availableCommands = `(${commands.new}, ${commands.show}, ${commands.exit})`
// // const availableCommands2 = '(' + commands.new + ', ' + commands.show + ', ' + commands.exit + ')';
// function start(command){
// if (command === commands.new){
// const toDo = prompt("Add new ToDo:");
// arr.push(toDo);
// start(prompt(`Choose another command ${availableCommands}`));
// } else if (command === commands.show){
// console.log(arr);
// start(prompt(`Choose another command ${availableCommands}`));
// } else if (command === commands.exit){
// return;
// } else {
// start(prompt(`You entered wrong command,choose another command ${availableCommands}`));
// }
// }
// start(prompt(`Choose command ${availableCommands}:`));
// const arr = [1, 2, 3, 4, 5, 6];
// function mapArray(item, index) {
// return item * 2 + index;
// }
// const newArr = arr.map(mapArray).reverse()
// console.log(newArr);
// function sumArr(arr){
// let result = 0;
// arr.forEach(function(item){
// result += item;
// })
// return result;
// }
// const array = [5, 44, 99, 100];
// console.log(sumArr(array));
// const arr = [20, true, "Alina"];
// const obj = {
// age: 20,
// isFemale: true,
// name: "Alina"
// };
// let age = obj["name"]
// age = obj.name