Spaces:
No application file
No application file
File size: 593 Bytes
d1cfa70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// Function to append the clicked button value to the display
function appendToDisplay(value) {
document.getElementById('display').value += value;
}
// Function to clear the display
function clearDisplay() {
document.getElementById('display').value = '';
}
// Function to calculate the result of the expression in the display
function calculateResult() {
try {
let result = eval(document.getElementById('display').value);
document.getElementById('display').value = result;
} catch (error) {
document.getElementById('display').value = 'Error';
}
}
|