Internet-programming-Pibd-2.../vite-project/counter.js

10 lines
247 B
JavaScript
Raw Normal View History

2023-12-01 11:17:36 +04:00
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)
}