From 96dab9b38091b449967c07c89b08c65556e5ffbe Mon Sep 17 00:00:00 2001 From: rivakutu Date: Sat, 7 Jun 2025 10:47:58 +0200 Subject: [PATCH 1/6] Answers questions about javascript functions --- questions-and-reviews/questions/0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/questions-and-reviews/questions/0.md b/questions-and-reviews/questions/0.md index ab3127d7..4ea7a9d2 100644 --- a/questions-and-reviews/questions/0.md +++ b/questions-and-reviews/questions/0.md @@ -20,9 +20,11 @@ const result2 = logSum(10, 32); a) what will `result1` evaluate to? Explain your answer -b) What will `result2` evaluate to? Explain your answer +b) What will `result2` evaluate to? c) Try to summarise the main difference between `logSum` and `calculateSum` - {YOUR ANSWERS HERE} +a) result 1 will evaluate to 42. The function calculates sum will return the sum of the two arguments +b) it will return undefined because the function does not return anything but console.log the sum of the argument +c) logSum will only log the answer where as calculateSum will return the sum that can be reusable From c729f8377d185302b829d5582bb4ef637bb56815 Mon Sep 17 00:00:00 2001 From: rivakutu Date: Sat, 7 Jun 2025 11:04:09 +0200 Subject: [PATCH 2/6] Adds prediction for 2.js output --- questions-and-reviews/questions/2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/questions-and-reviews/questions/2.md b/questions-and-reviews/questions/2.md index b9c7a189..a02460fa 100644 --- a/questions-and-reviews/questions/2.md +++ b/questions-and-reviews/questions/2.md @@ -3,14 +3,14 @@ In this task, you'll need to look at some code and predict what it does, **before running the program** This task will help you to develop your code reading skills. - Look at the code in `2.js`: read it carefully and discuss it with your pair. 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} +it will log to the console a star for each count. the first will be blank until it gets to 9 stars 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 +{ACTUAL OBSERVED BEHAVIOUR} From 4894405a274679a8b0d4c7dd17ec849a460e41dc Mon Sep 17 00:00:00 2001 From: rivakutu Date: Sat, 7 Jun 2025 11:04:24 +0200 Subject: [PATCH 3/6] Updates prediction for star logging --- questions-and-reviews/questions/2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/questions-and-reviews/questions/2.md b/questions-and-reviews/questions/2.md index a02460fa..a28a69bc 100644 --- a/questions-and-reviews/questions/2.md +++ b/questions-and-reviews/questions/2.md @@ -9,7 +9,7 @@ If some parts of the code are unfamiliar, then look them up on MDN. Write your prediction below: {YOUR PREDICTION HERE} -it will log to the console a star for each count. the first will be blank until it gets to 9 stars +it will log to the console a star for each count. it will start with one star until it gets to 10 stars Once you've written your prediction, then commit your work. Now actually run `2.js` using node and write your answer below: From a5efd1c619df3c43313ecdabc9e690259774fe0a Mon Sep 17 00:00:00 2001 From: rivakutu Date: Sat, 7 Jun 2025 11:15:43 +0200 Subject: [PATCH 4/6] Elaborates on fork and clone differences --- questions-and-reviews/questions/4.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/questions-and-reviews/questions/4.md b/questions-and-reviews/questions/4.md index 8661825d..4df96114 100644 --- a/questions-and-reviews/questions/4.md +++ b/questions-and-reviews/questions/4.md @@ -2,5 +2,8 @@ Q: What is the difference between a fork and cloned repository? A: {YOUR ANSWER HERE} +Remember to commit and push when you're finished! +fork +for collaboration as you create a service side copy of a repository on your account -Remember to commit and push when you're finished! \ No newline at end of file +cloning is for local work, typically clone your fork to start contributing From 7663c54628cb4a7e764aeae94a452354f8f94b5b Mon Sep 17 00:00:00 2001 From: rivakutu Date: Sat, 7 Jun 2025 12:07:40 +0200 Subject: [PATCH 5/6] Fixes times table and adds git definitions --- questions-and-reviews/questions/6.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/questions-and-reviews/questions/6.js b/questions-and-reviews/questions/6.js index 090afe52..d65a3fa0 100644 --- a/questions-and-reviews/questions/6.js +++ b/questions-and-reviews/questions/6.js @@ -1,13 +1,9 @@ - - - - function printTimesTables(n) { - const count = 1; - while(count <= 12) { - const product = n * i; - console.log(`${n} * ${i} = ${product}`); - count++; - } + let count = 1; + while (count <= 12) { + const product = n * count; + console.log(`${count} * ${n} = ${product}`); + count++; + } } - +printTimesTables(5); From 688e2de3f4846a7f61b25b246093d7509b00f834 Mon Sep 17 00:00:00 2001 From: rivakutu Date: Sat, 7 Jun 2025 12:08:15 +0200 Subject: [PATCH 6/6] Adds explanation of commit vs push --- questions-and-reviews/questions/3.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/questions-and-reviews/questions/3.md b/questions-and-reviews/questions/3.md index bc0764bc..33261bc0 100644 --- a/questions-and-reviews/questions/3.md +++ b/questions-and-reviews/questions/3.md @@ -1,4 +1,6 @@ Describe the difference between a commit and a push +{YOUR ANSWER HERE} +A commit in Git is a snapshot of your changes in a repository at a specific point in time -{YOUR ANSWER HERE} \ No newline at end of file +A push in Git is the process of sending your committed changes from your local repository to a remote repository, such as GitHub