Skip to content

Debugging#264

Open
shanny2022 wants to merge 3 commits into
Code-the-Dream-School:mainfrom
shanny2022:debugging
Open

Debugging#264
shanny2022 wants to merge 3 commits into
Code-the-Dream-School:mainfrom
shanny2022:debugging

Conversation

@shanny2022
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings March 9, 2026 01:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the number guessing game logic to resolve prior bugs and make game state updates (messages, reset, attempts) more consistent during play.

Changes:

  • Refactors message handling by introducing a corrected hideAllMessages() implementation.
  • Fixes and simplifies game reset via setup() (attempts reset, inputs re-enabled, messages/reset hidden).
  • Improves guess handling with range validation, pluralization for “guess/guesses”, and correct too-high/too-low/max-attempt outcomes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread index.js
const remainingAttempts = maxNumberOfAttempts - attempts;
// Checks the player's guess and updates the visible game messages.
function checkGuess() {
const guess = parseInt(guessInput.value, 10);
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parseInt() will coerce non-integer inputs like "1.9" or "1e2" into an integer (1), and Number.isInteger(guess) will still pass, so users can effectively submit values they didn’t enter. Prefer converting with Number(guessInput.value) (or parseFloat) and then validating with Number.isInteger(...) before proceeding.

Suggested change
const guess = parseInt(guessInput.value, 10);
const guess = Number(guessInput.value);

Copilot uses AI. Check for mistakes.
@mannsn
Copy link
Copy Markdown

mannsn commented Mar 9, 2026

Need a pull request against your forked main, not against the Code the dream debugging repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants