this.x[i] = ane.x[aneID];這句話報(bào)Uncaught ReferenceError: i is not defined這個(gè)錯(cuò)誤怎么解決??求大神解答
fruit.js中this.x[i] = ane.x[aneID];這句話報(bào)Uncaught ReferenceError: i is not defined這個(gè)錯(cuò)誤怎么解決??求大神解答
fruit.js中this.x[i] = ane.x[aneID];這句話報(bào)Uncaught ReferenceError: i is not defined這個(gè)錯(cuò)誤怎么解決??求大神解答
2016-01-12
舉報(bào)
2016-01-13
看看對(duì)象名寫對(duì)沒,是fruitObj,這是我的代碼
fruitObj.prototype.born=function(i)
{
var aneID=Math.floor(Math.random()*ane.num);
? ? this.x[i]=ane.x[aneID];
? ? this.y[i]=canHeight-ane.len[aneID];
? ? this.l[i]=0;
? ? this.alive[i]=true;
? ? var ran=Math.random();
? ? if(ran<0.2)
? ? {
? ? ? this.fruitType[i]="blue";//orange,blue
? ? }
? ? else{
? ? ? this.fruitType[i]="orange";
? ? }
? ??
?}