JSFiddle - React, Tailwind, and code Playground

by frogggeee McFrogggeee

JavaScript

let password = Math.floor(Math.random() * 999999999) + 1;
let guess = 0;
alert(" welcome to guess the number!");
alert("I am thinking of a number between 1 - 1,000,000,000. try to guess it.");
while (guess != password) {
  guess = prompt ("what is the number?");
  if (guess == password) {
    alert ("you got it right!");
  } else {
    if (0 / guess != 0) {
    	alert ("you didn't even type in a number!");
    } else if (guess < password) {
    	alert ("your guess was too low!");
    } else if (guess > password) {
    	alert ("your guess was too high!");
    }
  }
}