-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
31 lines (31 loc) · 901 Bytes
/
script.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
new Vue({
el: "#app",
data: {
number1: 0,
number2: 0,
result: 0
},
methods: {
addition: function() {
return this.result = Number(parseInt(this.number1) + parseInt(this.number2));
},
soustraction: function() {
return this.result = Number(this.number1 - this.number2);
},
multiplication: function() {
return this.result = Number(this.number1 * this.number2);
},
division: function() {
if (this.number1 == 0 || this.number2 == 0) {
return this.result = 0;
} else {
return this.result = Math.round(Number(parseInt(this.number1) / parseInt(this.number2)));
}
},
reset: function() {
this.result = 0;
this.number1 = 0;
this.number2 = 0;
}
}
});