Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ class Calculator {

compute() {
let computation
const prev = parseFloat(this.previousOperand)
const current = parseFloat(this.currentOperand)
const prevs = parseFloat(this.previousOperand)
const currentt = parseFloat(this.currentOperand)
if (isNaN(prev) || isNaN(current)) return
switch (this.operation) {
case '+':
computation = prev + current
computation = prevs + currentt
break
case '-':
computation = prev - current
computation = prevs - currentt
break
case '*':
computation = prev * current
computation = prevs * currentt
break
case '÷':
computation = prev / current
computation = prevs / currentt
break
default:
return
Expand Down Expand Up @@ -94,7 +94,9 @@ const allClearButton = document.querySelector('[data-all-clear]')
const previousOperandTextElement = document.querySelector('[data-previous-operand]')
const currentOperandTextElement = document.querySelector('[data-current-operand]')

const calculator = new Calculator(previousOperandTextElement, currentOperandTextElement)
const calculator = new Calculator(previousOperandTextElement, currentOperandTextElement);
const calc = users[];


numberButtons.forEach(button => {
button.addEventListener('click', () => {
Expand Down Expand Up @@ -123,4 +125,4 @@ allClearButton.addEventListener('click', button => {
deleteButton.addEventListener('click', button => {
calculator.delete()
calculator.updateDisplay()
})
})