I’m trying to add two values together e.g. 14.0 + 2.1 = 16.1 but I keep on getting them added onto each other e.g 14.0 + 2.1 = 14.02.1
var miledistance = miledistance1 + miledistance2;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For Java:
Make sure they are both float values.
Try casting:
Or use
Float.valueOf():For Javascript:
NOTE: Java and javascript are not the same language.