Question: Compulsory Task 3 Follow these steps: Create a JavaScript file called calculator.js in this folder. You are going to create a calculator that can do

Compulsory Task 3

Follow these steps:

Create a JavaScript file called calculator.js in this folder.

You are going to create a calculator that can do a calculation on any two

numbers you give it.

You will need to create four functions:

add This function will add the two numbers together.

subtract This function will subtract the second number from

the first number.

multiply This function will multiply the two numbers together.

divide This function will divide the first number by the second number.

Your calculator should ask the user to input the first number, the second number and what operation they would like to perform on those numbers.

The program should then log the calculation and the total to the console. For example if the user inputs 6, 7 and multiply, the output would be: 6 x 7 = 42

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!