<!-- HTML ->
<button id="btn-count">Count</button>
<p id="result"></p>
// JavaScript
const btnCount = document.getElementById('btn-count');
btnCount.addEventListener('click', () => {
let counter = 0;
counter++;
document.getElementById('result').innerText = counter;
});