This piece of code was created as a component of a calculator project for learning purposes. It functions correctly for the most part.
However, I noticed that the addition operation seems to concatenate the two numbers together instead of actually adding them. Why is this happening?
function calcApp (aNumber, bNumber) {
var a = prompt("Enter A number :");
var b = prompt("Enter B number :");
var mathSign = prompt("Enter Math Sign :");
aNumber = a;
bNumber = b;
if (mathSign == "+") {
alert(a + b);
}
else if (mathSign == "-") {
alert(a - b);
}
else if (mathSign == "*") {
alert(a * b);
}
else if (mathSign == "/") {
alert(a / b);
}
else {
prompt("Enter a valid Math sign!!")
}
}
calcApp();