Document
@@ -18,9 +18,9 @@
-
-
-
+
+
+
diff --git a/main.js b/main.js
index bf60c18..2df6e67 100644
--- a/main.js
+++ b/main.js
@@ -30,16 +30,20 @@ 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) => {
- // * 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 product = numA * numB
+ return product
+}
+
+const divide = (numA, numB) => {
+ const div = numA / numB
+ return div
}
-const divide = null
-// / to get a quotient,
-const modulus = null
-// and % to get a remainder.
+const modulus = (numA, numB) =>{
+ const mod = numA % numB
+ return mod
+}
// This function changes the "operation" variable to be equal to the "id" of the button we choose on the web page.
const changeOperation = (chosenOperation) => {
@@ -64,11 +68,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"
}