๐๐ฎ๐ ๐ฎ๐ฐ ๐ผ๐ณ ๐๐ฒ๐ฎ๐ฟ๐ป๐ถ๐ป๐ด ๐ ๐๐ฅ๐ก ๐ฆ๐๐ฎ๐ฐ๐ธ
I finished my DOM and Events lessons today. I spent my time building a project instead of watching videos.
I built a Tic-Tac-Toe game with vanilla JavaScript, HTML5, and CSS.
Writing code for a console is simple. Building logic for a user interface is different. It requires you to think about how a player interacts with the screen.
Here is how I built it:
- I created a 3x3 grid using nine button elements.
- I used CSS for a clean layout and hover effects.
- I wrote logic to check for winners.
To find a winner, I used an array of winning patterns. This covers all rows, columns, and diagonals:
[0, 1, 2], [3, 4, 5], [6, 7, 8] [0, 3, 6], [1, 4, 7], [2, 5, 8] [0, 4, 8], [2, 4, 6]
Building this helped me apply two weeks of lessons from Apna College. Practice makes the logic stick.
Source: https://dev.to/ali_hamza_589ec7b3eb6688d/day-24-of-learning-mern-stack-5eb3