I need help with my code; I need a counter that, when I click on the button, and when I miss I would like minus points. I am very new to coding, and I need help. Please respond if you have time.
function update(e) {
var x = e.clientX || e.touches[0].clientX
var y = e.clientY || e.touches[0].clientY
document.documentElement.style.setProperty('--cursorX', x + 'px')
document.documentElement.style.setProperty('--cursorY', y + 'px')
}
document.addEventListener('mousemove', update)
document.addEventListener('touchmove', update)
function jump() {
var x = Math.round((Math.random() * 101)) + "%",
y = Math.round((Math.random() * 101)) + "%";
document.getElementById("jump").style.left = x;
document.getElementById("jump").style.top = y;
}
body {
background-color: #21096b;
font-size: 30px;
text-align: center;
}
body {
margin: 0;
}
.button-container {
position: relative;
width: calc(100vw - 100px);
height: calc(100vh - 20px);
}
button {
position: absolute;
width: 20px;
height: 20px;
}
}
<div class="button-container">
<button id="jump" onclick="jump()"></button>
</div>