Skip to content

Commit d011b95

Browse files
authored
added users array
added users array for storing user data in future.
1 parent 4172ac7 commit d011b95

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

script.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ class Calculator {
3232

3333
compute() {
3434
let computation
35-
const prev = parseFloat(this.previousOperand)
36-
const current = parseFloat(this.currentOperand)
35+
const prevs = parseFloat(this.previousOperand)
36+
const currentt = parseFloat(this.currentOperand)
3737
if (isNaN(prev) || isNaN(current)) return
3838
switch (this.operation) {
3939
case '+':
40-
computation = prev + current
40+
computation = prevs + currentt
4141
break
4242
case '-':
43-
computation = prev - current
43+
computation = prevs - currentt
4444
break
4545
case '*':
46-
computation = prev * current
46+
computation = prevs * currentt
4747
break
4848
case '÷':
49-
computation = prev / current
49+
computation = prevs / currentt
5050
break
5151
default:
5252
return
@@ -94,7 +94,9 @@ const allClearButton = document.querySelector('[data-all-clear]')
9494
const previousOperandTextElement = document.querySelector('[data-previous-operand]')
9595
const currentOperandTextElement = document.querySelector('[data-current-operand]')
9696

97-
const calculator = new Calculator(previousOperandTextElement, currentOperandTextElement)
97+
const calculator = new Calculator(previousOperandTextElement, currentOperandTextElement);
98+
const calc = users[];
99+
98100

99101
numberButtons.forEach(button => {
100102
button.addEventListener('click', () => {
@@ -123,4 +125,4 @@ allClearButton.addEventListener('click', button => {
123125
deleteButton.addEventListener('click', button => {
124126
calculator.delete()
125127
calculator.updateDisplay()
126-
})
128+
})

0 commit comments

Comments
 (0)