Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let numeroSecreto = gerarNumeroAleatorio();

//let numeroSecreto = 7;
function exibirTextoNaTela(tag, texto) {
let campo = document.querySelector(tag);
campo.innerHTML = texto;
Expand All @@ -10,7 +10,17 @@ exibirTextoNaTela('p', 'Escolha um número entre 1 e 10');

function verificarChute() {
let chute = document.querySelector('input').value;
console.log(chute == numeroSecreto);

if (chute == numeroSecreto) {
exibirTextoNaTela('h1', 'Acertou!');
exibirTextoNaTela('p', 'Você descobriu o número secreto!');
} else {
if (chute > numeroSecreto) {
exibirTextoNaTela('p', 'O número secreto é menor');
} else {
exibirTextoNaTela('p', 'O número secreto é maior');
}
}
}

function gerarNumeroAleatorio() {
Expand Down