I tried to do a REALLY simple thing using JavaScript, a percentage calculator. This is the code:
var num = prompt("What is the number?")
var perc = prompt("What is the percentage of change?")
var math = num / (perc + 100) * 100
var result = alert(eval(math))
But, for some reason, I can sum, for example:
var num1 = 15
var num2 = 100
alert(num1 + num2)
It will display 115, but I can't sum using something like this:
var num1 = prompt("Input a number.")
var num2 = 100
alert(num1 + num2)
If I write 15 in num1, the alert will display 15100. I tried some things, but none of them worked, so I really need help on this.