【发布时间】:2014-03-17 05:35:10
【问题描述】:
我已经开始根据数组中的信息创建一系列对象,但后来无法使用数组信息来回调对象。这可能只是正确使用括号的问题:
total = 0
for item in @timelineArray
# This prints the object that was previously created
console.log Opening
# This prints the clip length for that object
console.log Opening.getClipLengthOutMinusIn()
# This prints the word Opening which is the first item in the timeline array
console.log item.name
# This yields an error "TypeError: Object Opening has no method 'getClipLengthOutMinusIn'"
total += (item.name).getClipLengthOutMinusIn()
提前感谢您的帮助。
【问题讨论】:
-
所以你有一个变量
Opening在范围内,然后item.name将是该变量的名称(Opening)?
标签: arrays object coffeescript