Day 5: DevTools Debugging & Week 2 Mini-Project
Daily Objective
Section titled “Daily Objective”Master Chrome DevTools Sources debugger with breakpoints and build the “Guess the Number” mini-project.
1. Debugging with Breakpoints
Section titled “1. Debugging with Breakpoints”Instead of guessing with console.log:
- Open Chrome DevTools -> Sources tab.
- Find
script.js. - Click on any line number to set a breakpoint.
- Trigger the code; execution pauses, allowing you to step over lines, inspect variable values, and watch expressions live!
Week 2 Mini-Project: “Guess the Number” Game
Section titled “Week 2 Mini-Project: “Guess the Number” Game”Project Requirements:
- Generate a random secret number between 1 and 100:
const secretNumber = Math.floor(Math.random() * 100) + 1;
- In a loop, prompt the user or simulate guesses.
- Compare the guess with the secret:
- If greater: Output “Too high! Try a lower number.”
- If lower: Output “Too low! Try a higher number.”
- If equal: Output congratulations and the number of attempts taken!