I have the following piece of code:
if(netAnnualBilling == null){
netAnnualBilling = 0;
parseFloat(netAnnualBilling);
}
parseFloat(netAnnualBilling);
annualBillingCount = (annualBillingCount + netAnnualBilling);
parseFloat(annualBillingCount);
My two variables netAnnualBilling and annualBillingCount are both of type numbers. However, when I get to this line:
annualBillingCount = (annualBillingCount + netAnnualBilling);
javascript seems to turn annualBillingCount into type String and appends the two numbers together instead of adding or subtracting as its supposed to. Example:
annualBillingCount = 0;
netAnnualBilling = -1403.30
The result of the above code will show annualBillingCount to be equal to : 0-1403.80
I've tried ParseFloat every time these variables pop up but I'm not having any luck. What's going on?