-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.js
43 lines (39 loc) · 979 Bytes
/
class.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
const our_first_obj = {
'0': '1',
'1': '2',
'2': '3',
}
const calculator = {
add: function addition(numbers){
const num_length = numbers.length;
let sum = 0;
for (i=0; i< num_length; i++) {
sum = numbers[i] + sum;
}
return sum;
},
subtract: function subtraction(numbers) {
const num_length = numbers.length;
let difference = 0;
for (i=0; i< num_length; i++) {
difference = numbers[i] / difference;
}
return difference;
},
multiply: function multiplication(numbers) {
const num_length = numbers.length;
let product = 0;
for (i=0; i< num_length; i++) {
product = numbers[i] * product;
}
return product;
},
divide: function division(numbers) {
const num_length = numbers.length;
let quotient = 0;
for (i=0; i< num_length; i++) {
quotient = numbers[i] / quotient;
}
return divide;
}
}