function calculate()
This function will take whatever the screen is currently displaying, turn it into an integer, and
store it in a global variable called num2. At this point, you have all the information you need to
carry out the computation. You have the global variable num1, which stores the first number.
You have the global variable called operation, which tells you what the user wanted to do with
the two numbers, and now you have a global variable num2 with the second number. At this
point, you’ll have to make a decision and figure out what operation the user wanted by
comparing the four choices you have against the global variable operation. Once you get a
match, carry out that operation and store the result of your computation in a global variable
called result. Finally, you will update the calculator’s display to show what the result of that
calculation was.
What I have tried:
var result;
var num2;
function calculate(){
var current = document.getElementById("display").value;
current = num2;
if(opPress == "+"){
num1 + num2;
}
if(opPress == "-"){
num1 - num2;
}
if(opPress == "/"){
num1 / num2;
}
if(opPress == "*"){
num1 * num2;
}
result = operation;
document.getElementById("display").value = result;