我收到错误:3210,我找不到原因。Javascript error'has no method push'
我知道sack[i]
是对象,i
是0和quantity_to_spawn
等于1
我认为这点与推动,因为麻袋是一个数组,sack[i]
实际上是一个对象的问题。
for (i=0;i<rows[r].quantity_to_spawn;i++){
more_drops = Math.random()
sack[i]=new Array();
for (;more_drops > .05;){
more_drops = Math.random()
rarity = Math.random()
if (rarity <= .75&&typeof rows[r].common=="string"){//common drop 75%
item=rows[r].common.split(",")
sack[i].push(parseInt(item[parseInt(Math.random()*item.length)]))
...
你外'for'循环之前宣布'sack'作为一个数组? – ZachB 2012-08-15 04:31:05
如果我在那里看到几个'var'关键字,我会更舒服...... – 2012-08-15 04:32:59
使用分号,它们不应该是可选的。为什么看起来一切都是全球性的? – epascarello 2012-08-15 04:34:41