What do I need to add to make the button turn off if pressed 10 times in less than 1 minute but keep counting if not pressed in 1 minute?
function buttonClicked() {
if (totalCount + accCounter > 9) {
document.getElementById("btn").disabled = true;
}
}
document.getElementById('btn').onclick = function() {
upClickCounter();
buttonClicked()
}
function upClickCounter() {
const clickCounter = document.getElementById("clicker");
const totalClickCounter = document.getElementById('totalCounter');
accCounter++;
clickCounter.children[0].innerText = '+' + accCounter;
totalClickCounter.innerText = totalCount + accCounter;
}
let accCounter = 0;
let totalCount = 0;
<button id="btn">Click me</button>
<div id="clicker">
<span></span>
</div>
<div id="totalCounter"></div>