6 - Javascript Tutorial - JavaScript Variables

preview_player
Показать описание
This video will talk about declaring & using variables & will give a small example about it.


Visit the forum at:

Follow us on twitter:

Become a fan on Facebook:
Рекомендации по теме
Комментарии
Автор

That is why... the prompt is taking the values as strings

Coderisland
Автор

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
Автор

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