js循环二维数组,输出左下半区

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var bigArr=[]
        var smallArr=[]
        for(var i=1;i<=25;i++){
            smallArr.push(i)
            if(smallArr.length===5){
                bigArr.push(smallArr);
                smallArr=[]
            }
        }
        for(var j=0;j<bigArr.length;j++){
            // console.log(bigArr[j])
            bigArr[j].length=j+1;
        }    
        console.log(bigArr);   
    </script>
</body>
</html>
posted @ 2020-11-07 11:22  无敌臭弟弟  阅读(139)  评论(0编辑  收藏  举报