Skip to content
Open

down #320

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions dom-merge-conflict/tasks/buttons-and-counter/src/app.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
//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() {
const body = document.createElement("body");

const header = document.createElement("header");
header.innerHTML = `
<h1>Number Counter</h1>
<h1>Number Counter Down</h1>
<p>A simple counter. Press increment to increase the count by one.</p>
`;
body.appendChild(header);
Expand All @@ -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;
Expand Down