𝗗𝗮𝘆 𝟯𝟭 𝗢𝗳 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗠𝗘𝗥𝗡 𝗦𝘁𝗮𝗰𝗸
I finished my first month of full-stack engineering. Now I am starting month two.
Today I built a Rock, Paper, Scissors game. I used HTML5, CSS3, and vanilla JavaScript.
Yesterday I worked on APIs. Today I focused on game logic. I built a system to track scores and manage user choices. I also built an automated opponent.
I structured the code into logical parts to keep it clean.
User Input: I linked rock, paper, and scissors to clickable elements. I used a forEach loop to add event listeners to every choice. This avoids repetitive code. The app pulls the user selection directly from the DOM.
Computer Logic: The computer needs a way to pick a move. I created an array with three options. I used Math.random() to pick a random index from that array.
This project helped me understand how to manage state and handle random logic in JavaScript.
Source: https://dev.to/ali_hamza_589ec7b3eb6688d/day-31-of-learning-mern-stack-15bm