[求助]求高手指點(diǎn)下面的代碼問(wèn)題出在哪里_html/css_WEB-ITnose
來(lái)源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 15:47:40
[求助]求高手指點(diǎn)下面的代碼問(wèn)題出在哪里_html/css_WEB-ITnose
[求助]求高手指點(diǎn)下面的代碼問(wèn)題出在哪里_html/css_WEB-ITnose:myMap.prototype.isCollide=function(shape_data){ for(var i=0;i var row=shape_data[i].row; var col=shape_data[i].col; if(col if(row==this.height) return true; if(row else if(this.myLines[row][col]!=NoShape) return true; } return false
導(dǎo)讀[求助]求高手指點(diǎn)下面的代碼問(wèn)題出在哪里_html/css_WEB-ITnose:myMap.prototype.isCollide=function(shape_data){ for(var i=0;i var row=shape_data[i].row; var col=shape_data[i].col; if(col if(row==this.height) return true; if(row else if(this.myLines[row][col]!=NoShape) return true; } return false

myMap.prototype.isCollide=function(shape_data){
for(var i=0;i<4;i++){
var row=shape_data[i].row;
var col=shape_data[i].col;
if(col<0 || col==this.width) return true;
if(row==this.height) return true;
if(row<0) continue;
else
if(this.myLines[row][col]!=NoShape)
return true;
}
return false;
}
運(yùn)行的時(shí)候老是提示紅色那一行無(wú)法獲取屬性“undefined”的值,對(duì)象為NULL或未定義。
回復(fù)討論(解決方案)
發(fā)錯(cuò)地方了
myLines row col
這三個(gè)變量有問(wèn)題 檢查一下是否有定義,或者myLines[row][col]是否越界了
myLines是個(gè)什么東西?代碼貼全一點(diǎn)啊
而且,這個(gè)東西最好轉(zhuǎn)到j(luò)s專(zhuān)區(qū)去。
myLines row col
這三個(gè)變量有問(wèn)題 檢查一下是否有定義,或者myLines[row][col]是否越界了
就是越界了。。問(wèn)題已經(jīng)解決了,呵呵,多謝了。
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
[求助]求高手指點(diǎn)下面的代碼問(wèn)題出在哪里_html/css_WEB-ITnose
[求助]求高手指點(diǎn)下面的代碼問(wèn)題出在哪里_html/css_WEB-ITnose:myMap.prototype.isCollide=function(shape_data){ for(var i=0;i var row=shape_data[i].row; var col=shape_data[i].col; if(col if(row==this.height) return true; if(row else if(this.myLines[row][col]!=NoShape) return true; } return false