Hey guys, I was working on a Javascript problem for the course here at IoT academy, and I’ve run into a problem that is confusing me with the console.
I was trying to have the user assign two variables and then add them together to display in the console. My code was as follows:
var a = window.prompt("Enter number 1: ");
var b = window.prompt("Enter number 2: “);
console.log(a+” + “+b+” = "+(a+b))
However, if I put 9 as a and 9 as b, the sum comes out 99. And no matter how hard I try, I can not seem to get it to come out to 18. Why is this? Any help would be appreciated!
If I do it as multiplication instead, it comes out correctly for some reason.