Skip to content

Day 5: DevTools Debugging & Week 2 Mini-Project

Master Chrome DevTools Sources debugger with breakpoints and build the “Guess the Number” mini-project.

Instead of guessing with console.log:

  1. Open Chrome DevTools -> Sources tab.
  2. Find script.js.
  3. Click on any line number to set a breakpoint.
  4. 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:

  1. Generate a random secret number between 1 and 100:
    const secretNumber = Math.floor(Math.random() * 100) + 1;
  2. In a loop, prompt the user or simulate guesses.
  3. 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!