(e)
| 410 | }; |
| 411 | |
| 412 | const handleCellClick = (e) => { |
| 413 | if (!gameIsLive) return; |
| 414 | |
| 415 | const cell = e.target; |
| 416 | const [rowIndex, colIndex] = getCellLocation(cell); |
| 417 | |
| 418 | const openCell = getFirstOpenCellForColumn(colIndex); |
| 419 | |
| 420 | if (!openCell) return; |
| 421 | |
| 422 | openCell.classList.add(greenIsNext ? "green" : "red"); |
| 423 | checkStatusOfGame(openCell); |
| 424 | |
| 425 | greenIsNext = !greenIsNext; |
| 426 | clearColorFromTop(colIndex); |
| 427 | |
| 428 | if (gameIsLive) { |
| 429 | const topCell = topCells[colIndex]; |
| 430 | topCell.classList.add(greenIsNext ? "green" : "red"); |
| 431 | playerTurn.textContent = `${ |
| 432 | greenIsNext ? firstPlayer : secondPlayer |
| 433 | }'s turn`; |
| 434 | } |
| 435 | }; |
| 436 | |
| 437 | for (const row of rows) { |
| 438 | for (const cell of row) { |
nothing calls this directly
no test coverage detected