我有一个辅助函数,它不在If或Else上进行评估。If/Else Statement Not Evaluating
我知道函数被调用,因为我有nlapiLogExecution
,这是你在NetSuite中调试的方式。有关正在记录什么的说明与代码有关。
这怎么可能?我也尝试使用==
运营商。我也尝试将它设置为函数内部的一个变量(我认为这是不必要的)。
function convertUnit(unit, cubicMeters){
nlapiLogExecution('DEBUG','convertUnitFunction',typeof(unit))
// typeof is String
nlapiLogExecution('DEBUG','convertUnitFunction',unit)
// value is Each
if (unit === 'Each'){
return cubicMeters
nlapiLogExecution('DEBUG','equals Each', cubicMeters)
// does not log here
}
else {
nlapiLogExecution('DEBUG','else statements', 'equals else')
// Does not log here
}
}
如果“if”条件为真,你的函数返回*之前*达到日志功能。 – nnnnnn
将'返回cubicMeters'作为块内的最后一条语句 – jeff
@nnnnnn是你的权利。我想我在下游的某个地方还有其他问题。 – nzaleski