From 971a8ffb51cde87de3a3a477c1870392896c1f84 Mon Sep 17 00:00:00 2001 From: brookecowey Date: Mon, 13 Feb 2023 20:32:52 -0600 Subject: [PATCH 1/2] updated index --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 063ab98..758f25c 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + Document From 3ca46986ddeab744c4a74cdb2bb810b93d944e4b Mon Sep 17 00:00:00 2001 From: brookecowey Date: Sun, 19 Feb 2023 10:27:34 -0600 Subject: [PATCH 2/2] fixed jss --- index.html | 6 +++--- main.js | 18 +++++++++++++----- style.css | 4 +++- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 758f25c..befa8b5 100644 --- a/index.html +++ b/index.html @@ -18,9 +18,9 @@ - - - + + +
diff --git a/main.js b/main.js index bf60c18..d2282bf 100644 --- a/main.js +++ b/main.js @@ -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 remainder = numA % numB +return remainder +} // 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" } diff --git a/style.css b/style.css index f6b4813..fb63496 100644 --- a/style.css +++ b/style.css @@ -2,4 +2,6 @@ body { margin: 20% auto; width: 50%; height: 75%; -} \ No newline at end of file + background-color: rgb(223, 176, 223); +} +