hey man i got an answer for your problem but i can not post source code here, if you posted your problem on the forum it would have bin a lot easier for us, the trick is to use parseInt() function, if you like you can go to coderisland website start a new thread & i will post you a whole code about how to acquire values from prompt box & casting it into integer.
Mine doesnt give the actual addition...
it always gives the value of the first number then the second number...
(I.E. 100100 instead of 200)
JustaFreak15 2 years ago
when you declare a var x you gave it the value with double quotes surrounding like this
x = "100";
y="100";
you should do it like this:
x=100;
y=100;
z=x+y;
if you got any detailed code or more questions visit the forum & post your questions there :)
Coderisland 2 years ago
no..
to be more specific I had a prompt for num1 and a prompt for num2 and then added the num1 and num2.
JustaFreak15 2 years ago
That is why... the prompt is taking the values as strings
Coderisland 2 years ago
Is there a way to make the prompt take it as an integer or decimal value?
JustaFreak15 2 years ago
hey man i got an answer for your problem but i can not post source code here, if you posted your problem on the forum it would have bin a lot easier for us, the trick is to use parseInt() function, if you like you can go to coderisland website start a new thread & i will post you a whole code about how to acquire values from prompt box & casting it into integer.
Coderisland 2 years ago