野生前端菜鸟
2017-01-30 01:02
function canMoveLeft( board ){
for( var i = 0 ; i < 4 ; i ++ )
for( var j = 1; j < 4 ; j ++ )
if( board[i][j] != 0 )
if( board[i][j-1] == 0 || board[i][j-1] == board[i][j] )
return true;
return false;
}
for循环内部吧
for( var i = 0 ; i < 4 ; i ++ ){ for( var j = 1; j < 4 ; j ++ ){ if( board[i][j] != 0 ){ if( board[i][j-1] == 0 || board[i][j-1] == board[i][j] ){ return true; } } } } return false;
慕课网2048私人订制
70013 学习 · 588 问题
相似问题