CLICKERRRR
This commit is contained in:
parent
ea464e791a
commit
1da54bac07
1 changed files with 15 additions and 1 deletions
16
js/intro.js
16
js/intro.js
|
@ -1,3 +1,4 @@
|
||||||
|
let score = 0
|
||||||
|
|
||||||
document.addEventListener("click",firstClick)
|
document.addEventListener("click",firstClick)
|
||||||
|
|
||||||
|
@ -6,5 +7,18 @@ function firstClick(){
|
||||||
const click = document.createElement("button")
|
const click = document.createElement("button")
|
||||||
click.innerText="click"
|
click.innerText="click"
|
||||||
document.body.appendChild(click)
|
document.body.appendChild(click)
|
||||||
document.removeEventListener("click",button)
|
|
||||||
|
const scoreAff = document.createElement("output")
|
||||||
|
scoreAff.innerText="SCORE"
|
||||||
|
scoreAff.id = "score_affichage"
|
||||||
|
document.body.appendChild(scoreAff)
|
||||||
|
click.addEventListener("click",scoreCount)
|
||||||
|
document.removeEventListener("click",firstClick)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function scoreCount(){
|
||||||
|
const scoreAff = document.getElementById("score_affichage")
|
||||||
|
score += 1
|
||||||
|
scoreAff.innerText="SCORE : " + score
|
||||||
}
|
}
|
Loading…
Reference in a new issue