Skip to content

Instantly share code, notes, and snippets.

@ivandevp
Created March 14, 2017 15:39
Show Gist options
  • Save ivandevp/028f64dff08b7374a5e6e21d7235516b to your computer and use it in GitHub Desktop.
Save ivandevp/028f64dff08b7374a5e6e21d7235516b to your computer and use it in GitHub Desktop.
Adivina el número en JS
var numero = parseInt(prompt("Ingresa un número (del 1 al 10):"));
var numeroAleatorio = Math.floor(Math.random() * 10);
debugger;
if (numeroAleatorio === numero) {
console.log("Adivinaste!");
} else {
console.log("Perdiste! El número es " + numeroAleatorio);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment