【发布时间】:2019-08-31 18:18:43
【问题描述】:
我编写了用于简单重量转换的代码和一个要求用户输入的年度利润计算器程序。当我在 vscode 中运行程序时,它显示错误“ReferenceError:提示未定义。”
var weight_in_lbs = prompt("Please enter the weight in lbs you wish to convert:");
var pound_to_kg = (weight_in_lbs * .45359237);
console.log("The weight converted in kg is" + " " + pound_to_kg.toFixed(3))`
var annualSales = prompt("What is the projected total sales amount?");
var salesPrediction = (annualSales * .23);
console.log ("Your annual profit is " + salesPrediction.toFixed(2)) ;
【问题讨论】:
-
您是否有机会在 Node 环境中运行它?
-
@Clarity OP 说它正在 vscode 中运行
-
@Pointy 听起来确实像是在节点环境中运行的。除非我错过了什么。
-
请提供更多细节以继续提供建议
标签: javascript calculator prompt referenceerror