-
Notifications
You must be signed in to change notification settings - Fork 695
Open
Description
alert('Boas vindas ao Jogo do Número Secreto!');
let numMax = 10
let numS = parseInt(Math.random() * numMax + 1)
console.log(numS);
let tent;
let tentativas = 1;
while (tent != numS) {
tent = prompt(Escolha um número de 1 a ${numMax});
if (numS == tent) {
break;
} else {
if (tent > numS) {
alert(O número é menor que ${tent});
} else {
alert(O número é maior que ${tent});
}
tentativas++;
}
}
let palavraTentativa = tentativas > 1 ? 'tentativas' : "tentativa"
alert(Parabéns, você acertou o número secreto ${numS} com ${tentativas} ${palavraTentativa});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels