Hola a todos!
Comparto mi código, gracias por leer el post y si gustan dejar algún comentario bienvenido.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unit 5, Guess</title>
</head>
<body>
<h1>Guess a number</h1>
<script>
function saltarLinea() {
document.write("<br><br><br><hr><br><br>");
}
function imprimir(frase) {
document.write("<big>" + frase + "</big>");
saltarLinea();
}
alert("Can you guess a number between 0 and 10?");
var numeroPensado = Math.round(Math.random() * 10);
var numeroLanzado = parseFloat(prompt("Try it! Put your number"));
alert("Let's see if you have guess right.");
if (numeroPensado == numeroLanzado){
imprimir("YOU ARE RIGHT! previously we have choosen the number: " + numeroPensado + "," + " and yours is: " + numeroLanzado);
}
if (numeroPensado != numeroLanzado){
imprimir("You are wrong! I am sorry, the right number was: " + numeroPensado + "," + " and yours is: " + numeroLanzado);
}
</script>
</body>
</html>