var TotalSales = $2, 500, 000;
var Profit = (TotalSales * 23 / 100);
console.log {
"annual profit:" + math.floor {
Profit
};
答案 0 :(得分:1)
在Javascript中,您无法使用
编写数字,
(或任何,就此而言)您可以在Javascript here
中详细了解数字此外,当您定义一项功能时,您使用的是{
,但当您调用一项功能时,例如console.log()
您使用(
。您可以了解有关函数here的更多信息。
所以代码需要看起来像这样:
var TotalSales = 2500000;
var Profit = (TotalSales * (23 / 100));
console.log("annual profit: $" + Math.floor(Profit));

答案 1 :(得分:0)
不要使用' $'和','同时为变量
赋值<script>
var TotalSales = 2500000;
var Profit = (TotalSales * 23 / 100);
console.log ("annual profit:" + Profit);
</script>
答案 2 :(得分:0)
java代码:
double TotalSales = 2500000;
double profit = (TotalSales * 23 / 100);
int floorProfit = (int) Math.round(profit);
System.out.println("annual profit: "+floorProfit);