-4
我想了解这两段代码是如何不同的。javascript;下面两段代码之间有什么区别
var bill=10.25+3.99+7.15;
var tip = bill*0.15;
var total=bill+tip;
total = total.toFixed(2);
console.log("$"+total);
而且
var bill=10.25+3.99+7.15;
var tip = bill*0.15;
var total=bill+tip;
console.log("$"+total.toFixed(2));
他们没有任何实质性的意义。 – glennsl
其中之一在输出之前更新'total'变量。另一个没有。 – David
你为什么认为它们不同?它们都是一样的,就像'console.log(“$”+((10.25 + 3.99 + 7.15)* 1.15).toFixed(2));'。 – Xufox