let clickable = true;
const callback = (event) => {
if (!clickable) {
return;
}
(중략)
if (turn === 'X') {
const emptyCells = rows.flat().filter((v) => !v.textContent);
const randomCell = emptyCells[Math.floor(Math.random() * emptyCells.length)];
clickable = false;
setTimeout(() => {
randomCell.textContent = 'X';
checkWinnerAndDraw(randomCell);
clickable = true;
}, 1000);
}
};