Skip to content

Commit 73941a8

Browse files
authored
Update index.js
1 parent 06730db commit 73941a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function createBoard() {
44
for (let i = 0; i < 16; i++){
55
let tile = document.createElement('div');
66
tile.setAttribute('id', `id_${i}`);
7-
tile.textContent = "";
7+
tile.textContent = 0;
88
gridContainer.appendChild(tile);
99
}
1010
}
@@ -13,7 +13,7 @@ function generate(){
1313
let numArray = [2,2,2,2,2,2,2,2,2,4];
1414
let num = numArray[Math.floor(Math.random()*numArray.length)]
1515
let allBlocks = document.querySelectorAll('.grid>div');
16-
let filteredBlocks = [...allBlocks].filter((a) => a.textContent == "");
16+
let filteredBlocks = [...allBlocks].filter((a) => a.textContent == 0);
1717
if (filteredBlocks == 0){
1818
return;
1919
}

0 commit comments

Comments
 (0)