From a23e0e1a3ce537e0c64c702f5a7437e5a50d27ec Mon Sep 17 00:00:00 2001 From: scottydixon Date: Wed, 26 Jul 2023 18:23:32 -0500 Subject: [PATCH 1/4] first commit --- index.html | 9 +++++---- main.js | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 063ab98..7ba386f 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,11 @@ - + Document +
@@ -18,9 +19,9 @@ - - - + + +
diff --git a/main.js b/main.js index bf60c18..0f5515f 100644 --- a/main.js +++ b/main.js @@ -19,7 +19,7 @@ const saveSecondNumber = (num) => { const add = (numA, numB) => { const sum = numA + numB return sum -} +}; // this function takes in two argument/numbers and returns the difference of them const subtract = (numA, numB) => { @@ -30,15 +30,23 @@ const subtract = (numA, numB) => { // These variables are already defined but that don't point to functions. It's up to you to build the functions to complete your calculator use: const multiply = (numA, numB) => { + const product = numA * numB + return product // * to get a product then return it // Open up the inspector tool in Chrome and select the Console tab to see what this functions is "logging out" to the console. console.log(numA, numB) } -const divide = null +const divide = (numA, numB) => { + const quotient = numA / numB + return quotient +} // / to get a quotient, -const modulus = null +const modulus = (numA, numB) => { + const modulus = numA % numB + return modulus +} // and % to get a remainder. // This function changes the "operation" variable to be equal to the "id" of the button we choose on the web page. @@ -64,11 +72,11 @@ const equals = () => { break; case "subtraction": putResultInElement(subtract(firstNum, secondNum)) break; - case "multiplication": multiply(firstNum, secondNum) + case "multiplication": putResultInElement(multiply(firstNum, secondNum)) break; - case "division": console.log(divide(firstNum, secondNum)) + case "division": putResultInElement(divide(firstNum, secondNum)) break; - case "modulus": console.log(modulus(firstNum, secondNum)) + case "modulus": putResultInElement(modulus(firstNum, secondNum)) break; default: "Choose an operation" } From 63cf2e3439f2bb4b1653cac840d0e736a7a9217b Mon Sep 17 00:00:00 2001 From: scottydixon Date: Wed, 26 Jul 2023 18:27:02 -0500 Subject: [PATCH 2/4] second commit --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 7ba386f..1d1592d 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ Document - + @@ -26,7 +26,7 @@
- +
From b6d10086b66d9728d9255a9336414ea2be3deac4 Mon Sep 17 00:00:00 2001 From: scottydixon Date: Wed, 26 Jul 2023 18:33:27 -0500 Subject: [PATCH 3/4] first commit --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 1d1592d..8f89292 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,7 @@
- +
From 2b2980089303c5ae12b6d1b775383f5de877a0fe Mon Sep 17 00:00:00 2001 From: scottydixon Date: Wed, 26 Jul 2023 18:40:03 -0500 Subject: [PATCH 4/4] last commit --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 8f89292..4400ba2 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,7 @@
- +