frontend-mentor/results-summary-component/counter.js
2023-05-23 20:25:52 -07:00

9 lines
247 B
JavaScript

export function setupCounter(element) {
let counter = 0
const setCounter = (count) => {
counter = count
element.innerHTML = `count is ${counter}`
}
element.addEventListener('click', () => setCounter(counter + 1))
setCounter(0)
}