gpt4 book ai didi

javascript - 值在 Javascript 中不断添加为字符串

转载 作者:行者123 更新时间:2023-12-04 06:13:57 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Addition turns into concatenation

这是我所拥有的...

    var srate = Math.round(princ * intr * term * 100) / 100; //works fine
var dasvalue = princ + srate; //doesn't work
document.calc.pay.value = dasvalue;

“var dasvalue = princ + srate;”将两个总和作为字符串相加。

100 + 1.4 = 1001.4

我做错了什么?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com