-
Notifications
You must be signed in to change notification settings - Fork 0
/
JSES6-03
47 lines (33 loc) · 866 Bytes
/
JSES6-03
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
let numbers = [1,2,3,4,5];
function sumUp(toAdd) {
let result = 0;
for (let i = 0; i < toAdd.length; i++) {
result += toAdd[i];
}
return result;
}
console.log(sumUp(numbers));
console.log("<----------------------------------------------->");
function sumUpp(...toAdd) {
console.log(toAdd)
}
sumUpp(100,10,20);
console.log("<----------------------------------------------->");
function sumUppp(...toAdd) {
let result = 0;
for (let i = 0; i < toAdd.length; i++) {
result += toAdd[i];
}
return result;
}
console.log(sumUppp(100,20,10));
console.log("<----------------------------------------------->");
let numbersX = [1,2,3,4,5];
console.log(Math.max(...numbers));
console.log("<----------------------------------------------->");
let testX = [1,2,3,4,5];
for (let testY of testX) {
console.log(testY);
testX+1;
testY+1;
}