In this task, you'll create a calculator that has two numbers and an operation, and the calculator will perform the operation on those two numbers.
Example, the two numbers could be 3
and 5
, and the operation could be +
, then the calculator will add 3
and 5
, and print to the user 3 + 5 = 8
.
- Open this folder in Visual Studio Code.
- In
calculator.js
, create a variable for the first number. - Create a second variable for the second number.
- Create a third variable for the operation (addition
+
, subtraction-
, multiplication*
, or division/
). - Use if-statements to check which operation the variable has.
- Perform the mathematical operation to the two numbers, and print the result to the user.
To submit your work, simply push your code to GitHub.
After finishing the task and verifying your work, follow these steps to push your code to GitHub:
- Navigate to project root (where
calculator.js
is). - Run the command
git add .
- Run
git commit -m "your message here"
. - Push to GitHub:
git push
.