diff --git a/dom-merge-conflict/tasks/buttons-and-counter/src/app.js b/dom-merge-conflict/tasks/buttons-and-counter/src/app.js index af608eb6..5ddaae84 100644 --- a/dom-merge-conflict/tasks/buttons-and-counter/src/app.js +++ b/dom-merge-conflict/tasks/buttons-and-counter/src/app.js @@ -1,7 +1,11 @@ //increments the number in a node's text -function increment(node) { +// function increment(node) { +// let current = node.textContent; +// node.textContent = Number(current) + 1; +// } +function decrement(node) { let current = node.textContent; - node.textContent = Number(current) + 1; + node.textContent = Number(current) - 1; } export function App() { @@ -9,7 +13,7 @@ export function App() { const header = document.createElement("header"); header.innerHTML = ` -

Number Counter

+

Number Counter Down

A simple counter. Press increment to increase the count by one.

`; body.appendChild(header); @@ -24,7 +28,7 @@ export function App() { const button = body.querySelector("#increment"); const counter = body.querySelector("#counter"); button.addEventListener("click", () => { - increment(counter); + decrement(counter); }); return body;