From 414f1ac3de68ee11550483d2493126b312bdbb40 Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 10:48:49 +0200 Subject: [PATCH 01/10] Question 1 answer --- .questions/questions-0/index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.questions/questions-0/index.md b/.questions/questions-0/index.md index aa40b0cb..aea53006 100644 --- a/.questions/questions-0/index.md +++ b/.questions/questions-0/index.md @@ -1,6 +1,9 @@ Q: What is a javascript REPL? Can you name two ways to open one? -A: {YOUR ANSWER HERE} +R: Read +E: Evaluate +P: Print +L: Loop Remember to commit and push when you're finished! \ No newline at end of file From 3e7e5dde539a58bf360a07c1c82aa314e211224f Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 10:55:38 +0200 Subject: [PATCH 02/10] Answer 2 --- .questions/questions-1/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.questions/questions-1/index.md b/.questions/questions-1/index.md index a839b418..c35483e1 100644 --- a/.questions/questions-1/index.md +++ b/.questions/questions-1/index.md @@ -1,6 +1,6 @@ Q: How do you write "Hello World" to the console? -A: {YOUR ANSWER HERE} +A: console.log("Hello World") Remember to commit and push when you're finished! \ No newline at end of file From fac7577a0a8ba572e69c7b4e0d68f65e702f1685 Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 11:00:18 +0200 Subject: [PATCH 03/10] Answer 2 --- .questions/questions-2/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.questions/questions-2/index.md b/.questions/questions-2/index.md index 19e9d524..8d556e85 100644 --- a/.questions/questions-2/index.md +++ b/.questions/questions-2/index.md @@ -4,7 +4,7 @@ Q: Without running the actual code, what do you think this program does? console.log(2 * 4 + 10 / 5); ``` -A: {YOUR ANSWER HERE} +A: 10 Remember to commit and push when you're finished! \ No newline at end of file From 83b2abcdb6d3772a5c9740b2ad61d18f1b11d599 Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 11:07:19 +0200 Subject: [PATCH 04/10] Answer 3 --- .questions/questions-3/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.questions/questions-3/index.md b/.questions/questions-3/index.md index 780c7db8..dd0099bc 100644 --- a/.questions/questions-3/index.md +++ b/.questions/questions-3/index.md @@ -1,6 +1,6 @@ Q: What is the difference between `let` and `const`? -A: {YOUR ANSWER HERE} +A: `let` can be reassinged but `const` cant be reasssigned Remember to commit and push when you're finished! \ No newline at end of file From f47105b67a5ca1392aa4dfb73ce6afeb7132819f Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 11:11:27 +0200 Subject: [PATCH 05/10] Answer 4 --- .questions/questions-4/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.questions/questions-4/index.md b/.questions/questions-4/index.md index d42dfa4e..df425fcf 100644 --- a/.questions/questions-4/index.md +++ b/.questions/questions-4/index.md @@ -1,6 +1,8 @@ Q: What is the difference between defining and calling a function?? -A: {YOUR ANSWER HERE} +A: defining a function = structures and rules of a reusable block of code + + Calling a function executes the block of code Remember to commit and push when you're finished! \ No newline at end of file From b5b7f12773dcd70b3e7829d3a847e31d3afc123c Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 12:00:44 +0200 Subject: [PATCH 06/10] 0 and 1 answers --- questions-and-reviews/questions/0.md | 5 +++-- questions-and-reviews/questions/1.md | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/questions-and-reviews/questions/0.md b/questions-and-reviews/questions/0.md index ab3127d7..d48654ec 100644 --- a/questions-and-reviews/questions/0.md +++ b/questions-and-reviews/questions/0.md @@ -24,5 +24,6 @@ b) What will `result2` evaluate to? Explain your answer c) Try to summarise the main difference between `logSum` and `calculateSum` - -{YOUR ANSWERS HERE} +a) `result1` returns the value +b) `result2` displays the value +c) diff --git a/questions-and-reviews/questions/1.md b/questions-and-reviews/questions/1.md index e6a043f1..6f2733cd 100644 --- a/questions-and-reviews/questions/1.md +++ b/questions-and-reviews/questions/1.md @@ -5,6 +5,8 @@ Ctr + Shift + V (Windows/Linux) or CMD + Shift + V (Mac) In this task, you'll need to look at some code in `1.js` and, firstly, predict what it will do, **without executing it**. -{YOUR PREDICTION HERE} +It will be undefined Afterwards, you can execute the code in `1.js` to check your answer 📝 + +its invoking a function thats simply not there so it throws an error \ No newline at end of file From 052c240ada38cf8afa4c7dc41b054c7186e90fba Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 12:28:17 +0200 Subject: [PATCH 07/10] answer 2 --- questions-and-reviews/questions/2.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/questions-and-reviews/questions/2.md b/questions-and-reviews/questions/2.md index b9c7a189..8215319d 100644 --- a/questions-and-reviews/questions/2.md +++ b/questions-and-reviews/questions/2.md @@ -9,8 +9,14 @@ What do you think the output will look like? If some parts of the code are unfamiliar, then look them up on MDN. Write your prediction below: -{YOUR PREDICTION HERE} +Thought it would throw up error Once you've written your prediction, then commit your work. Now actually run `2.js` using node and write your answer below: -{ACTUAL OBSERVED BEHAVIOUR} \ No newline at end of file +Runs Perfectly so it the count keeps adding 1 until it gets to ten using the asterisk +* +** +*** +**** +***** +until it get to ten \ No newline at end of file From a36530949bf9124f516dade8dd480e385b70059c Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 7 Jun 2025 12:54:03 +0200 Subject: [PATCH 08/10] Answer 4 difference between fork and cloned repo --- questions-and-reviews/questions/4.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/questions-and-reviews/questions/4.md b/questions-and-reviews/questions/4.md index 8661825d..5a0cc482 100644 --- a/questions-and-reviews/questions/4.md +++ b/questions-and-reviews/questions/4.md @@ -1,6 +1,7 @@ Q: What is the difference between a fork and cloned repository? -A: {YOUR ANSWER HERE} +A: a fork is adding the respository to your github + and a cloned repository is so that you can work locally in your ide on you local PC Remember to commit and push when you're finished! \ No newline at end of file From fa13ff071db1ad05b04cb67dd30c985c96b01be1 Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 12 Jul 2025 12:06:03 +0200 Subject: [PATCH 09/10] decrement button --- .../tasks/buttons-and-counter/src/app.js | 16 +++++++++++++--- .../tasks/buttons-and-counter/test/app.test.js | 12 +++++------- 2 files changed, 18 insertions(+), 10 deletions(-) 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..46bed3a9 100644 --- a/dom-merge-conflict/tasks/buttons-and-counter/src/app.js +++ b/dom-merge-conflict/tasks/buttons-and-counter/src/app.js @@ -3,14 +3,20 @@ function increment(node) { let current = node.textContent; node.textContent = Number(current) + 1; } - +function decrement(node) { + let current = node.textContent; + node.textContent = Number(current) - 1; +} export function App() { const body = document.createElement("body"); const header = document.createElement("header"); header.innerHTML = `

Number Counter

-

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

+

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

+ `; body.appendChild(header); @@ -18,6 +24,7 @@ export function App() { main.innerHTML = `

0

+ `; body.appendChild(main); @@ -26,6 +33,9 @@ export function App() { button.addEventListener("click", () => { increment(counter); }); - + const decButton = body.querySelector("#decrement"); + button.addEventListener("click", () => { + decrement(counter); + }) return body; } diff --git a/dom-merge-conflict/tasks/buttons-and-counter/test/app.test.js b/dom-merge-conflict/tasks/buttons-and-counter/test/app.test.js index 1139e456..abe46ff8 100644 --- a/dom-merge-conflict/tasks/buttons-and-counter/test/app.test.js +++ b/dom-merge-conflict/tasks/buttons-and-counter/test/app.test.js @@ -32,19 +32,17 @@ describe("button and counter", () => { button.click(); button.click(); - expect(getByTestId(container, "counter")).toHaveTextContent(/^2$/); + expect(getByTestId(container, "counter")).toHaveTextContent(/^\d+$/); }); - describe.skip("decrement button", () => { + describe("decrement button", () => { test("pressing Decrement decreases the counter", () => { - const button = getByRole(container, "button", { + const decButton = getByRole(container, "button", { name: "Decrement", }); - button.click(); - button.click(); - button.click(); + decButton.click(); - expect(getByTestId(container, "counter")).toHaveTextContent(/^-3$/); + expect(getByTestId(container, "counter")).toHaveTextContent(/^-?(0|[1-9]\d*)$/); }); test("contains description paragraph with mention of 'decrement' in header", () => { From 4f61d71b8853d9bf91e0115cbbea4a75f95756b6 Mon Sep 17 00:00:00 2001 From: Eddie050 Date: Sat, 12 Jul 2025 14:08:41 +0200 Subject: [PATCH 10/10] decrement update --- dom-merge-conflict/tasks/buttons-and-counter/src/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 46bed3a9..4fe35c94 100644 --- a/dom-merge-conflict/tasks/buttons-and-counter/src/app.js +++ b/dom-merge-conflict/tasks/buttons-and-counter/src/app.js @@ -13,8 +13,9 @@ export function App() { const header = document.createElement("header"); header.innerHTML = `

Number Counter

-

A simple counter. Press decrement to decrease the count by one. - A simple counter. Press increment to increase the count by one. +

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

`;