所以这是我的代码。这是一个非常简单的运费计算器。当我运行它时,只显示一个询问购买价格的消息框,然后显示这个“​”。有谁知道发生了什么?
<!DOCTYPE html>
<html lang="en">
<head>
<title> Shipping Calculator</title>
<script >
var purchasePrice = window.prompt("Please enter the price of your purchase to calculate your shipping cost.");
var shippingPrice;
function shippingMath(purchasePrice, shippingPrice) {
if (purchasePrice <= 25) {
shippingPrice = 1.50;
}
else {
shippingPrice = (purchasePrice * '.10');
}
var totalCost = (purchasePrice + shippingPrice);
return totalCost;
}
shippingMath(purchasePrice, shippingPrice);
document.writeln("Your total is " + totalCost);
</script>
</head>
<body>
</body>
</html>
任何帮助表示赞赏。谢谢。这是为了学校作业,所以这是我允许这样做的唯一方法。一个简单的功能,没有数组或其他任何东西。谢谢!</p>