-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
29 lines (25 loc) · 1.14 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function comecar() {
document.querySelector('.container').classList.remove('vermelho');
let numero = Math.floor(Math.random() * 20);
let intervalo = setInterval(function(){
if (numero <= 0) {
document.querySelector('h1').innerHTML = 'QUEIMOU!';
document.querySelector('button').style.display = "block";
document.querySelector('#perdeu').play();
document.querySelector('.container').classList.add('vermelho');
document.querySelector('button').innerHTML = "JOGAR DE NOVO";''
clearInterval(intervalo);
return;
}
numero = numero - 1;
document.querySelector('h1').innerHTML = 'QUENTE';
document.querySelector('.container').classList.toggle('verde');
}, 700);
}
function clicou(e) {
e.preventDefault();
document.querySelector('h1').innerHTML = "BATATA";
comecar();
document.querySelector('button').style.display = "none";
}
document.querySelector('button').addEventListener('click', clicou);