Skip to content

This is a Tic-Tac-Toe game made with HTML , CSS , JS .

Notifications You must be signed in to change notification settings

Abbas7120/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe Game

Description

This JavaScript code snippet implements the logic for a basic tic-tac-toe game. It allows players to take turns clicking on boxes to mark them with "X" or "O" and checks for a winner after each move.

Usage

Setup: Ensure you have a set of HTML elements representing the tic-tac-toe grid. These elements should be stored in an array named boxes.

Event Handling: Use the provided code snippet to handle click events on the grid boxes. The code toggles between "X" and "O" marks for each click, disables the clicked box .

Checking for a Winner: The checkWinner() function (not provided in the snippet) should be implemented separately. This function should be called after each move to determine if a player has won the game.

Error Handling: Ensure that boxes is properly initialized as an array containing DOM elements representing the grid boxes. Handle cases where boxes is not an array to prevent errors.

About

This is a Tic-Tac-Toe game made with HTML , CSS , JS .

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published