猿问

for循环的问题

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <script type="text/javascript">
            var allPoint =[]
             
             //棋盘上的点加第n种赢法组成三维数组 //allWins
             var allWins =[]
             
             var count = 0 //第0种赢法
             
             //allWins 纵向五个子的赢法
             for(var i = 0; i < 19; i ++){
                 allWins[i]=[]
                 for(var j =0;j < 15;j ++){
                     for(var k =0;k < 5 ; k++){
                         allWins[i][j+k]=[]
                         allWins[i][j+k][count] = true
                     }
                     count++
                 }
             }
             
             //allWins横向赢法
             for(var i = 0; i < 15; i ++){
                 for(var j =0;j < 19; j ++){
                     for(var k =0;k < 5 ; k++){
                         allWins[i+k][j][count] = true
                     }
                     count++
                 }
             }
             
             //allWins 正斜线
             
             for(var i = 0; i < 15; i ++){
                 for(var j =4;j < 19; j ++){
                     for(var k =0;k < 5 ; k++){
                         allWins[i+k][j-k][count] = true
                     }
                     count++
                 }
             }
             
             
             //allWins 反斜线
             
             for(var i = 0; i < 15; i ++){
                 for(var j =0;j < 15; j ++){
                     for(var k =0;k < 5 ; k++){
                         allWins[i+k][j+k][count] = true
                     }
                     count++                     
                 }
             }
             alert(count)
             console.log('????????????'+count)
             
             //我的赢法统计
             var myWins =[]
             
             for(var i = 0; i < count ; i++){
//               myWins[i] = 0 
                 console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!"+i)
//               console.log(i+'!!'+myWins[i])
             }
             
             //对方赢法统计
             var yourWins =[]
             for(var i = 0; i < count ; i++){
                 yourWins[i] = 0 
             }
        </script>
    </body>
</html>

为什么 console.log('????????????'+count) 不会被执行 :
console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!"+i) 不是从i等于0开始输出


Codeplayer
浏览 1113回答 2
2回答

行走的指尖

360极速有执行,chrome也有执行

OlderSkee

没有问题的,只是console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!"+i)太长了。。把初始的给挤掉了,开着控制台刷新下就可以了。我是chrome 。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答