I\'m trying to calculate the number of payments but output was wrong so i tried to calculate a simple operation on the month value.But \"+\" operator doesn\'t sum my values it a
The actual type of the value is string. That's why string concatenation is happening. You have to use parseInt to convert string to integer to perform intended arithmetic operation.
Change:
var months=(principal)+(interestrate);
To:
var months = parseInt(principal) + parseInt(interestrate);