<meta charset="utf-8">
<script>
function pulaLinha(); {
document.write("<br>");
}
function mostrarTela(frase) {
document.write(frase);
pulaLinha();
}
var numeroPensado = Math.round(Math.random() * 10);
var tentativas = 1;
while( tentativas <= 3) {
var chute = parseInt(prompt("Digite seu chute!"));
if(chute == numeroPensado) {
mostrarTela("Você acertou!");
}
else {
mostrarTela("Você errou, o número pensado foi " + numeroPensado);
}
tentativas++
}
</script>