Add calculator call to operator section
This commit is contained in:
parent
dce94d7165
commit
b23ce98b4e
1 changed files with 4 additions and 2 deletions
|
|
@ -13,7 +13,6 @@ function displayToScreen() {
|
||||||
|
|
||||||
console.log(screen.textContent)
|
console.log(screen.textContent)
|
||||||
screen.textContent = calc.calculate(screen.textContent) + " ";
|
screen.textContent = calc.calculate(screen.textContent) + " ";
|
||||||
console.log(typeof(screen.textContent))
|
|
||||||
} else if (this.className == "clear") {
|
} else if (this.className == "clear") {
|
||||||
//clear´
|
//clear´
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -22,7 +21,10 @@ function displayToScreen() {
|
||||||
if (this.className == "operator") {
|
if (this.className == "operator") {
|
||||||
for (let i = 0; i < screenContent.length; i++ ) {
|
for (let i = 0; i < screenContent.length; i++ ) {
|
||||||
if (operators.includes(screenContent[i])) {
|
if (operators.includes(screenContent[i])) {
|
||||||
//call calculator
|
let calc = new Calculator;
|
||||||
|
|
||||||
|
console.log(screen.textContent)
|
||||||
|
screen.textContent = calc.calculate(screen.textContent) + " ";
|
||||||
console.log("An operator was pressed again")
|
console.log("An operator was pressed again")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue