Add function to update content of screen
This commit is contained in:
parent
a378ac3cf5
commit
ea4c135b29
3 changed files with 20 additions and 2 deletions
17
script.js
17
script.js
|
|
@ -1,3 +1,20 @@
|
|||
const screen = document.querySelector(".screen")
|
||||
const buttons = document.querySelectorAll("button")
|
||||
|
||||
buttons.forEach((button) => {
|
||||
button.addEventListener ("click", displayToScreen);
|
||||
});
|
||||
|
||||
function displayToScreen() {
|
||||
|
||||
if(this.className == "equal") {
|
||||
//testButton();
|
||||
} else {
|
||||
screen.textContent = this.textContent;
|
||||
console.log("A button was pressed")
|
||||
}
|
||||
}
|
||||
|
||||
function Calculator(str) {
|
||||
|
||||
this.methods = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue