Plus operator in JavaScript doesn't sum my values

前端 未结 4 1778
深忆病人
深忆病人 2021-01-28 22:57

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

4条回答
  •  耶瑟儿~
    2021-01-28 23:21

    var months=parseInt(principal)+parseInt(interestrate);
    

    Values need to be converted to an integer first.

提交回复
热议问题