Internt_Programmirovanie_PI.../Lab4/web-site vite/counter.js
2023-11-21 12:37:22 +04:00

10 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)
}