- š Hi, Iām @Douglascosta18170
- š Iām interested in ...
- š± Iām currently learning ...
- šļø Iām looking to collaborate on ...
- š« How to reach me ...
- š Pronouns: ...
- ā” Fun fact: ...
let tries = 3;
function checkGuess() { let guess = parseInt(document.getElementById('guessInput').value); let message = document.getElementById('message');
if (guess === secretNumber) {
message.textContent = 'Congratulations! You guessed the correct number.';
document.getElementById('guessInput').setAttribute('disabled', 'true');
document.querySelector('button').setAttribute('disabled', 'true');
} else {
tries--;
if (tries > 0) {
message.textContent = `Wrong! ${tries} ${tries > 1 ? 'tries' : 'try'} left.`;
} else {
message.textContent = `Game over! The correct number was ${secretNumber}.`;
document.getElementById('guessInput').setAttribute('disabled', 'true');
document.querySelector('button').setAttribute('disabled', 'true');
}
}
}