-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (21 loc) · 819 Bytes
/
Copy pathindex.js
File metadata and controls
25 lines (21 loc) · 819 Bytes
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
/*
--------------------------------------------------------------------------------------
Calculator in HTML,CSS and JS - (c) 2023 NH (N3v1) - Use at your own risk, no warranty
--------------------------------------------------------------------------------------
*/
function appendOperation(operation) {
document.getElementById('resultArea').innerHTML +=operation;
}
function calculateResult() {
let container = document.getElementById('resultArea');
let result = eval(container.innerHTML);
container.innerHTML = result;
}
function deleteLast() {
let container = document.getElementById('resultArea');
if(container.innerHTML.endsWith(' ')) {
container.innerHTML = container.innerHTML.slice(0, -3);
} else {
container.innerHTML = container.innerHTML.slice(0, -1);
}
}