const createBall = timer => {
if (isWon) {
clearInterval(timer);
alert('Bingo!');
return;
}
const output = document.querySelector('.output'),
ballNum = generateNumbers(25, 100),
ball = document.createElement('span');
ball.className = 'num';
ball.textContent = ballNum;
output.appendChild(ball);
checkCell(ballNum);
checkHorizontal();
checkVertical();
};
const startGame = () => {
let timer;
displayOutput();
removeBtn('remove');
removeBtn('addCard');
removeBtn('startGame');
createButton('stop', 'Stop Gaming', stopGame);
timer = setInterval(() => {
createBall(timer);
}, 2000);
};
??? cell[0] cell[5] cell[10] cell[15] cell[20]
cell[1] cell[5] cell[11] cell[16] cell[21]
cell[2] cell[6] cell[12] cell[17] cell[22]
cell[3] cell[7] cell[13] cell[18] cell[23]
cell[4] cell[8] cell[14] cell[19] cell[24]
const checkVertical = () => {
const cell = Array.from(document.querySelectorAll('.cell'));
for (let i = 0; i < cell.length; i += 5) {
console.log(cell[i]); // только первая строка
}
};