Git Product home page Git Product logo
  • šŸ‘‹ 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 secretNumber = Math.floor(Math.random() * 10) + 1;

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');
    }
}

}

douglascosta18170's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.