};
let cell;
+ let row
for (let i = 0; i < 7; i++) {
const span = document.createElement("span");
board.rows[0].appendChild(document.createElement("th"));
board.rows[0].lastChild.textContent = i + 1;
- const row = board.insertRow(-1);
+ row = board.insertRow(-1);
row.appendChild(document.createElement("th"));
row.lastChild.textContent = letters[i];
cell.lastChild.className = "tile-placeholder";
if (i === j && i === 7) {
- specialCell("doubleWord", board.lastChild.lastChild);
- cell = board.lastChild.lastChild.getElementsByClassName("special-cell-label")[0];
+ specialCell("doubleWord", row.lastChild);
+ cell = row.lastChild.getElementsByClassName("special-cell-label")[0];
cell.textContent = "★";
row.lastChild.id = "center-cell";
} else if (i % 7 === 0 && j % 7 === 0) {
- specialCell("tripleWord", board.lastChild.lastChild);
+ specialCell("tripleWord", row.lastChild);
} else if ((i === j || i + j === 14) && (i < 5 || i > 9)) {
- specialCell("doubleWord", board.lastChild.lastChild);
+ specialCell("doubleWord", row.lastChild);
} else if ((i % 4 === 1) && (j % 4 === 1)) {
- specialCell("tripleLetter", board.lastChild.lastChild);
+ specialCell("tripleLetter", row.lastChild);
} else if ((i < 8 && doubleLetter[i + "," + j]) || (i > 7 && doubleLetter[(14 - i) + "," + j]) || (i === 7 && (j === 3 || j === 11))) {
- specialCell("doubleLetter", board.lastChild.lastChild);
+ specialCell("doubleLetter", row.lastChild);
}
}
board.rows[0].appendChild(board.rows[0].cells[0].cloneNode(false));
- const row = board.insertRow(-1);
+ row = board.insertRow(-1);
row.appendChild(board.rows[0].cells[0].cloneNode(false));
for (let i = 0; i < 15; i++) {