【发布时间】:2019-03-23 17:59:55
【问题描述】:
我正在迭代一个数组,在 CoffeeScript 中迭代时出现undefined 变量错误。我不太确定在 CoffeeScript 中迭代数组时如何检查未定义。
请在下面找到我的代码。
i=0
while Program.flatPercentageDiscountByMajorClass.length
var
if typeof Program.flatPercentageDiscountByMajorClass[i].majorClass == 'undefined' // this line is not working. throwing Undefined error
FlatPercentageFlag = true
else
PdpTableFlag = true
break
i++
【问题讨论】: