Namal Posted December 22, 2006 Share Posted December 22, 2006 There are 3 variables in my Javascript document.Those are:value1, value2, value3.I created a function call mytestfuncion and I included following:function mytestfunction(){value1=10;value2=20;value3=value1+value2;}my expected result is value3= 30. but I received result is: 1020Then pls explain how can get my expected result. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 22, 2006 Share Posted December 22, 2006 try this function mytestfunction(){var value1=10;var value2=20;var value3=value1+value2;} if that doesn't work do this function mytestfunction(){var value1 = 10;var value2 = 20;var value3 = parseInt(value1) + parseInt(value2);} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now