Help us understand the problem. What is going on with this article?

ビンゴシートを作成

マスは二次元配列で作成(過去のオセロゲームを参考)
真ん中はfree
ページ更新するたびに中身を更新
bの列には1~15
iの列には16~31
nの列には31~45
gの列には46~60
oの列には61~75
を入れるようにする

const sheet =document.getElementById("field")

function newSheet() {
    for (var x = 0; x < 6; x++){
        const tr = document.createElement("tr")
        sheet.appendChild(tr)

        for (var y = 0; y < 5; y++){
            var td = document.createElement("td");
            if (x === 0) {
                switch (y){
                case 0:
                    td.textContent ="B"
                    break;
                case 1:
                    td.textContent = "I"
                    break;
                case 2:
                    td.textContent = "N"
                    break;
                case 3:
                    td.textContent = "G"
                    break;
                case 4:
                    td.textContent = "O"
                    break;
                }
            } else {
                switch (y){
                    case 0:
                        td.textContent = (Math.floor(Math.random() * 15 + 1))
                        break;
                    case 1:
                        td.textContent = (Math.floor(Math.random() * 15 + 16))
                        break;
                    case 2:
                        td.textContent = (Math.floor(Math.random() * 15 + 31))
                        if (x === 3) {
                            td.textContent = "free"
                        }
                        break;
                    case 3:
                        td.textContent = (Math.floor(Math.random() * 15 + 46))
                        break;
                    case 4:
                        td.textContent = (Math.floor(Math.random() * 15 + 61))
                        break;
                    }
            }
               tr.appendChild(td)
        }
    }

}

newSheet()
ToaruEngineer
エラーが解決すると ^~心がぴょんぴょんするんじゃぁ^~
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away