-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
135 lines (125 loc) · 2.81 KB
/
script.js
File metadata and controls
135 lines (125 loc) · 2.81 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
var btnN = [];
$("#n0").click(function () {
let n0 = $(this).val();
$("#show").val(n0);
$("#show").append(n0);
btnN += n0;
});
$("#n1").click(function () {
let n1 = $(this).val();
$("#show").val(n1);
$("#show").append(n1);
btnN += n1;
});
$("#n2").click(function () {
let n2 = $(this).val();
$("#show").val(n2);
$("#show").append(n2);
btnN += n2;
});
$("#n3").click(function () {
let n3 = $(this).val();
$("#show").val(n3);
$("#show").append(n3);
btnN += n3;
});
$("#n4").click(function () {
let n4 = $(this).val();
$("#show").val(n4);
$("#show").append(n4);
btnN += n4;
});
$("#n5").click(function () {
let n5 = $(this).val();
$("#show").val(n5);
$("#show").append(n5);
btnN += n5;
});
$("#n6").click(function () {
let n6 = $(this).val();
$("#show").val(n6);
$("#show").append(n6);
btnN += n6;
});
$("#n7").click(function () {
let n7 = $(this).val();
$("#show").val(n7);
$("#show").append(n7);
btnN += n7;
});
$("#n8").click(function () {
let n8 = $(this).val();
$("#show").val(n8);
$("#show").append(n8);
btnN += n8;
});
$("#n9").click(function () {
let n9 = $(this).val();
$("#show").val(n9);
$("#show").append(n9);
btnN += n9;
});
//operations
$("#division").click(function () {
let div = $(this).val();
$("#show").val(div);
$("#show").append(div);
btnN += div;
});
$("#mult").click(function () {
let x = $(this).val();
$("#show").val(x);
$("#show").append(x);
btnN += x;
});
$("#plus").click(function () {
let plus = $(this).val();
$("#show").val(plus);
$("#show").append(plus);
btnN += plus;
});
$("#power").click(function () {
let n1 = Number(prompt("Digite o primeiro valor"));
let n2 = Number(prompt("Digite o segundo valor"));
let resultpow = Math.pow(n1, n2);
$("#show").append(resultpow);
});
$("#square").click(function () {
let sqrt = prompt("Digite o valor que deseja saber a raiz quadrada")
let resultsq = sqrt ** (1 / 2)
$("#show").append(resultsq);
});
$("#arredon").click(function () {
if (btnN.length > 0) {
btnN = Math.round(btnN);
$("#show").text("");
//make more sense when you click to round and the exctaly time show the result
$("#show").append(btnN);
}
console.log(arr)
btnN += arr;
});
$("#mines").click(function () {
let min = $(this).val();
$("#show").val(min);
$("#show").append(min);
btnN += min;
});
$("#comma").click(function () {
let comma = $(this).val();
$("#show").val(comma);
$("#show").append(comma);
btnN += comma;
});
//clear the array and the results
$('#clear').focus().click(function () {
$("#show").text("");
btnN = [];
});
//show the results
$('#result').click(function () {
var result = eval(btnN)
$("#show").val(result)
$("#show").html(result)
console.log(result)
});