Having some trouble as a beginner and it's driving me crazy; can't seem to figure out what I'm doing wrong. Seeking help with my Javascript
code. No errors are showing up, but also not getting any results displayed. Here is the snippet:
var sumIt;
var subtractIt;
var multiplyIt;
var divideIt;
var operatorOpt = prompt("Select operator");
function showResult(whatResult) {
document.write(whatResult);
document.write("<br>");
}
var doSomething = function(num1, num2) {
if (operatorOpt == sumIt) {
showResult("The result is: " + (num1 + num2));
} else if (operatorOpt == subtractIt) {
showResult("The result is: " + (num1 - num2));
} else if (operatorOpt == multiplyIt) {
showResult("The result is: " + (num1 * num2));
} else if (operatorOpt == divideIt) {
showResult("The result is: " + (num1 / num2));
doSomething(parseInt (prompt("Enter first number: ")) , parseInt (prompt("Enter second number: ")))