-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathideas
More file actions
47 lines (35 loc) · 1.17 KB
/
ideas
File metadata and controls
47 lines (35 loc) · 1.17 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
let firstNum = ""; // "2" or 2
let secondNum = ""; // "3" or 3
let operator = ""; // "+"
let result = "";
let mainDisplay = document.getElementById("display2");
let btn2 = document.getElementById("2").addEventListener("click", numberPress);
let btn3 = document.getElementById("3").addEventListener("click", numberPress);
document.getElementById("=").addEventListener("click", equalsPress);
document.getElementById("+").addEventListener("click", operatorPress);
// TEST CASE: 2 + 3 = 5
// STEP 1: Press 2
// EXPECT: 2 displays on the screen
// ACTUAL: IT WORKS!
// STEP 2: Press +
// EXPECT: 2 displays on the screen
// ACTUAL: IT WORKS!
// STEP 3: Press 3
// EXPECT: 3 displays on the screen
// ACTUAL: 22 displays on the screen
// STEP 4: Press =
// EXPECT: 5 display on the screen
// ACTUAL: 222 displays on the screen
function numberPress(e) {
operator
console.log("number button was pressed");
}
function operatorPress(e) {
console.log("operator button was pressed");
}
function equalsPress(e) {
console.log("equals button was pressed");
console.log("firstNum: ", firstNum);
console.log("secondNum: ", secondNum);
console.log("operator: ", operator);
}