-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc.js
48 lines (41 loc) · 996 Bytes
/
func.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
var HangDoi = "0";
var ketQua = "0";
const capNhat = (mode) => {
document.getElementById("noi-dung-hien-thi").innerText = (
mode ? HangDoi : ketQua
)
.toString()
.substr(0, 17);
};
const xoaSach = () => {
HangDoi = String();
HangDoi = "0";
capNhat(true);
};
const themVao = (phim) => {
if (isNaN(phim)) {
if (!isNaN(HangDoi[HangDoi.length - 1])) HangDoi += phim;
} else {
HangDoi += phim;
if (!(HangDoi[0] == "0" && isNaN(HangDoi[1])))
while (HangDoi[0] == 0) HangDoi = HangDoi.slice(1);
}
capNhat(true);
};
const xuat = () => {
return HangDoi.toString();
};
const tinh = () => {
ketQua = eval(HangDoi).toString();
if (ketQua == "Infinity") ketQua = "Vô lý!";
xoaSach();
capNhat(false);
};
var rgb = false;
const kiemTra = () => {
rgb = !rgb;
if (rgb)
document.getElementById("noi-dung-hien-thi").classList.add("rainbow-text");
else
document.getElementById("noi-dung-hien-thi").classList.remove("rainbow-text");
};