-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (25 loc) · 1 KB
/
index.js
File metadata and controls
31 lines (25 loc) · 1 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
const numbersButton = document.querySelectorAll('[data-num]');
const operatorsButton = document.querySelectorAll('[data-ops]');
const clearButton = document.getElementById('clear');
const viewerTextElement = document.getElementById('viewer')
const equalsButton = document.querySelector('equals');
const numberZeroButton = document.querySelector('number-zero');
const firstOperandTextElement = document.getElementById('firstElement');
const secondOperandTextElement = document.getElementById('secondElement');
const displayVal = '';
const updateDisplayValue = (clickBtn) => {
const btnText = clickBtn.target.innerText;
viewerTextElement.innerText = btnText;
}
numbersButton.forEach(button => {
button.addEventListener('click', updateDisplayValue, false)
})
// operatorsButton.forEach(button => {
// button.addEventListener('click', () => {
// calculator.getOperator(button.innerText);
// })
// })
// clearButton.addEventListener('click', () => {
// calculator.clear();
// calculator.updateDisplay();
// })