About 1,600,000 results
Open links in new tab
  1. do while javascript - loop for guessing game - Stack Overflow

    Jul 31, 2015 · function guessGame(){ number = Math.floor(Math.random()*11); document.write(number); var guess = prompt("Guess a number: "); while (guess != number) { if (number < guess) { guess = prompt("You've guessed too high! Keep guessing!"); } else { guess = prompt("You've guessed too low!

  2. javascript - Guessing game, 1 to 100 using do/while loop and …

    Jun 13, 2016 · First of all you need to change while (guessed = false) into while (guessed === false) because it should be a comparision, hence you have to use a comparator. Secondly, you are using document.write() .

  3. arrays - guessing game in javascript using while loop and …

    Oct 24, 2016 · var x = Math.floor(Math.random() * 100) + 1; var hint = 'Guess my number, 1-100!'; var userIsGuessing = true; while (userIsGuessing) { var guess = prompt(hint + ' Keep guessing!');

  4. Number Guessing Game using JavaScript - GeeksforGeeks

    Sep 23, 2024 · A Number Guessing Game is a simple game where the player tries to guess a randomly generated number within a specified range. Using JavaScript, you can create this game by generating a random number, taking user input, …

  5. JavaScript Program to Guess a Random Number

    The user is prompted to guess a number from 1 to 10. The parseInt() converts the numeric string value to an integer value. The while loop is used to take input from the user until the user guesses the correct answer.

  6. 6 Easy to build JavaScript Games for Beginners - Contact Mentor

    1. Number Guessing Game. The simplest game to being with is a game that allows users to input a number as a guess within a given range, this is followed by alerting the result when submit button is clicked. In order to implement the game, you need to know the basics of JS DOM which includes document selectors and properties associated with it.

  7. Building a Simple “Guess the Number” Game using JavaScript.

    Aug 22, 2023 · Creating a simple JavaScript game is a fantastic way to learn while having an enjoyable experience. In this blog post, we’ll guide you through the process of building a basic “Guess the...

  8. Create Number Guessing Game Using JavaScript - Code With …

    Aug 23, 2022 · In this article, we create a Number Guessing Game Using JavaScript. We use If/Else Function in JavaScript Code For Show Message on Screen that guesses the number right or not. A user is required to estimate a number between 0 and 100 in a maximum of 10 attempts in a number-guessing game.

  9. Number Guessing Game using while loop - Stack Overflow

    May 6, 2015 · Each set of guess output needs to be numbered to indicate how many guesses have been made. For the output, I need to use innerHTML. The user will guess a number from 1 to 999. I have to use while loop. So far this is the code where I'm working and I have some errors and it's not working.

  10. Help with Loops for Number Guessing Game assignment

    Oct 20, 2017 · Our first assignment is to build a number guessing game. Seems to be a common first assignment lol.Anyway, I am stuck with how to do one of the final steps, which is to run a loop with “You Win!” 10 times after the player guesses the correct answer.

  11. Some results have been removed
Refresh