From 1da54bac073017ae74695d5e0f7625e707a6a7e9 Mon Sep 17 00:00:00 2001 From: beau Date: Thu, 21 Nov 2024 11:45:31 +0100 Subject: [PATCH] CLICKERRRR --- js/intro.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/js/intro.js b/js/intro.js index 0e03944..10ca202 100644 --- a/js/intro.js +++ b/js/intro.js @@ -1,3 +1,4 @@ +let score = 0 document.addEventListener("click",firstClick) @@ -6,5 +7,18 @@ function firstClick(){ const click = document.createElement("button") click.innerText="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 } \ No newline at end of file