From 1d8957c82042cca34177f9ad64b074d41c0b9d3b Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 10:29:12 +0100 Subject: [PATCH 01/81] Add hello_world.js file --- prep/hello_world.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/hello_world.js diff --git a/prep/hello_world.js b/prep/hello_world.js new file mode 100644 index 000000000..e69de29bb From cb5fd1c539a93eb845d7382f1e5ba72c483853b0 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 10:32:20 +0100 Subject: [PATCH 02/81] Add hello_world.js file with initial console log --- prep/hello_world.js | 1 + 1 file changed, 1 insertion(+) diff --git a/prep/hello_world.js b/prep/hello_world.js index e69de29bb..de8882976 100644 --- a/prep/hello_world.js +++ b/prep/hello_world.js @@ -0,0 +1 @@ +console.log("Hello World!"); \ No newline at end of file From 3dcb7b7d9e93946c205353e63f089fb2e4b4eaf1 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 10:38:31 +0100 Subject: [PATCH 03/81] Add fact.js file --- prep/fact.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/fact.js diff --git a/prep/fact.js b/prep/fact.js new file mode 100644 index 000000000..e69de29bb From 14998aefee1f66afc2b5e4d35c6c9a12739d0a03 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 10:40:23 +0100 Subject: [PATCH 04/81] Add fun fact about sprints to fact.js --- prep/fact.js | 1 + 1 file changed, 1 insertion(+) diff --git a/prep/fact.js b/prep/fact.js index e69de29bb..fa5cbb09f 100644 --- a/prep/fact.js +++ b/prep/fact.js @@ -0,0 +1 @@ +console.log("One fun fact about sprints is reading the instructions carefully, and making further research."); \ No newline at end of file From 4b9c01a3657c712b79ca005b57ee8f97a39655e2 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 10:42:31 +0100 Subject: [PATCH 05/81] Rename file fact.js to facts.js --- prep/{fact.js => facts.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename prep/{fact.js => facts.js} (100%) diff --git a/prep/fact.js b/prep/facts.js similarity index 100% rename from prep/fact.js rename to prep/facts.js From 386a826e84e137e39a9b46032acb590e7b26e4d0 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 11:25:59 +0100 Subject: [PATCH 06/81] Add greeting.js file --- prep/greeting.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/greeting.js diff --git a/prep/greeting.js b/prep/greeting.js new file mode 100644 index 000000000..e69de29bb From ed354a357b7691fa4e4955ecb72560707d352726 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 11:26:55 +0100 Subject: [PATCH 07/81] Add greeting message to greeting.js --- prep/greeting.js | 1 + 1 file changed, 1 insertion(+) diff --git a/prep/greeting.js b/prep/greeting.js index e69de29bb..8b2e74583 100644 --- a/prep/greeting.js +++ b/prep/greeting.js @@ -0,0 +1 @@ +const greeting = "Hello there!"; \ No newline at end of file From 02c297f1815e8df2d43ea7aeada977d7ade0e002 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 11:29:58 +0100 Subject: [PATCH 08/81] Add console log for greeting message in greeting.js --- prep/greeting.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prep/greeting.js b/prep/greeting.js index 8b2e74583..2ee37185c 100644 --- a/prep/greeting.js +++ b/prep/greeting.js @@ -1 +1,2 @@ -const greeting = "Hello there!"; \ No newline at end of file +const greeting = "Hello there!"; +console.log(greeting); \ No newline at end of file From d3c778f173a471c8f051b08726362885f45859ac Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 11:39:40 +0100 Subject: [PATCH 09/81] Update greeting message to include name in greeting.js --- prep/greeting.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prep/greeting.js b/prep/greeting.js index 2ee37185c..9de68f666 100644 --- a/prep/greeting.js +++ b/prep/greeting.js @@ -1,2 +1,3 @@ -const greeting = "Hello there!"; -console.log(greeting); \ No newline at end of file +const greeting = "Hello there"; +const name = "Mr Moses"; +console.log(`${greeting}, ${name}!`); \ No newline at end of file From 041137983d755869ed51fa9109b9a8577c5316a0 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 11:53:17 +0100 Subject: [PATCH 10/81] Change greeting variable from const to let and update its value to "Good Morning" --- prep/greeting.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prep/greeting.js b/prep/greeting.js index 9de68f666..c13178591 100644 --- a/prep/greeting.js +++ b/prep/greeting.js @@ -1,3 +1,4 @@ -const greeting = "Hello there"; +let greeting = "Hello there"; +greeting = "Good Morning"; const name = "Mr Moses"; console.log(`${greeting}, ${name}!`); \ No newline at end of file From c6ad8eb5484346eb713dc9351b9e5b00f2458f1c Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 12:01:46 +0100 Subject: [PATCH 11/81] Add boolean.js file --- prep/boolean.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/boolean.js diff --git a/prep/boolean.js b/prep/boolean.js new file mode 100644 index 000000000..e69de29bb From d2880fb4bb027c18b9f98cf4ec6d3145daa40896 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 12:21:23 +0100 Subject: [PATCH 12/81] Add boolean.js with initial console log comparisons --- prep/boolean.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/prep/boolean.js b/prep/boolean.js index e69de29bb..5cf610ff1 100644 --- a/prep/boolean.js +++ b/prep/boolean.js @@ -0,0 +1,13 @@ +console.log(42 === 10 + 32); + +console.log(10 * 5 === 60); + +console.log("hello" === "hello"); + +console.log("CYF" === "cyf"); + +const homeTown = "Newcastle" +//homeTown === "Liverpool" +console.log("homeTown" === "Liverpool") + +console.log(42 === 42) \ No newline at end of file From 2bddb02ab5d0030f289ec740a76aff60af3a5f27 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Mon, 14 Sep 2026 12:30:56 +0100 Subject: [PATCH 13/81] Add additional comparison console logs in boolean.js --- prep/boolean.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prep/boolean.js b/prep/boolean.js index 5cf610ff1..a3c3268bc 100644 --- a/prep/boolean.js +++ b/prep/boolean.js @@ -7,7 +7,11 @@ console.log("hello" === "hello"); console.log("CYF" === "cyf"); const homeTown = "Newcastle" -//homeTown === "Liverpool" +homeTown === "Liverpool" console.log("homeTown" === "Liverpool") -console.log(42 === 42) \ No newline at end of file +console.log(42 === 42) + +console.log(42 === "42") + +console.log(42 == "42") \ No newline at end of file From 3f06814d56ae29252ef12e5da34583de0d09847e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:09:50 +0100 Subject: [PATCH 14/81] Add passwordChecker.js file --- prep/passwordChecker.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/passwordChecker.js diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js new file mode 100644 index 000000000..e69de29bb From 1b3d99b169ca11a0b265aad1a3cdb2ff4dfcc0c8 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:18:44 +0100 Subject: [PATCH 15/81] Add password validation logic in passwordChecker.js --- prep/passwordChecker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index e69de29bb..3e5192922 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -0,0 +1,6 @@ +const password="secretword123"; +const userInput="secretword123"; + +if(userInput === password){ + console.log("Correct password entered"); +} \ No newline at end of file From 56326fbbe1eb147950e7d8349ee7ed6315d27842 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:24:39 +0100 Subject: [PATCH 16/81] Add else statement to password validation logic --- prep/passwordChecker.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index 3e5192922..37774913f 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -3,4 +3,6 @@ const userInput="secretword123"; if(userInput === password){ console.log("Correct password entered"); +} else{ + console.log("Incorrect password!"); } \ No newline at end of file From cae89270b31e6c298f529c08dae4056892fb7580 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:25:44 +0100 Subject: [PATCH 17/81] Update userInput for password validation test --- prep/passwordChecker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index 37774913f..2c341f2a0 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -1,5 +1,5 @@ const password="secretword123"; -const userInput="secretword123"; +const userInput="thisiswrong"; if(userInput === password){ console.log("Correct password entered"); From ad792cdced65b774a0866a5ffbf438494a417a9b Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:37:47 +0100 Subject: [PATCH 18/81] Add adminPassword variable in passwordChecker.js --- prep/passwordChecker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index 2c341f2a0..a669c3a96 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -1,8 +1,11 @@ const password="secretword123"; const userInput="thisiswrong"; +const adminPassword="override"; if(userInput === password){ console.log("Correct password entered"); -} else{ +} + +else{ console.log("Incorrect password!"); } \ No newline at end of file From 31d84260140c9e2f55546548360c1d91afc762f4 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:41:11 +0100 Subject: [PATCH 19/81] Add else if condition to password validation logic in passwordChecker.js --- prep/passwordChecker.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index a669c3a96..6cb451a19 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -5,7 +5,9 @@ const adminPassword="override"; if(userInput === password){ console.log("Correct password entered"); } - +else if(userInput === adminPassword){ + console.log("Admin access granted"); +} else{ console.log("Incorrect password!"); } \ No newline at end of file From 0f097a321ef29cb0e17d48d21e861303b3113525 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:48:42 +0100 Subject: [PATCH 20/81] Add exercise.js file --- prep/exercise.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 prep/exercise.js diff --git a/prep/exercise.js b/prep/exercise.js new file mode 100644 index 000000000..e69de29bb From 1d56388d621e31cf1808254164d07c271d8841f1 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:53:12 +0100 Subject: [PATCH 21/81] Remove unused exercise.js file --- prep/exercise.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 prep/exercise.js diff --git a/prep/exercise.js b/prep/exercise.js deleted file mode 100644 index e69de29bb..000000000 From 220a7144128de6bedf4ff3be295cb5f7b855a3cc Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:56:48 +0100 Subject: [PATCH 22/81] Add response variable declaration in passwordChecker.js --- prep/passwordChecker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index 6cb451a19..c6b27b4bc 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -1,6 +1,7 @@ const password="secretword123"; const userInput="thisiswrong"; const adminPassword="override"; +const response=""; if(userInput === password){ console.log("Correct password entered"); From 762e97f6b1edbc67277ea01d71f81ed1d4b07e4d Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Tue, 15 Sep 2026 23:58:58 +0100 Subject: [PATCH 23/81] Update else condition to assign response message for incorrect password in passwordChecker.js --- prep/passwordChecker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index c6b27b4bc..b75a9d2a7 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -10,5 +10,5 @@ else if(userInput === adminPassword){ console.log("Admin access granted"); } else{ - console.log("Incorrect password!"); -} \ No newline at end of file + response="Incorrect password!"; +} From 39b87c37dcd22a10e7e7c53e96867b3650c4f051 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 00:00:50 +0100 Subject: [PATCH 24/81] Log response message for incorrect password in passwordChecker.js --- prep/passwordChecker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index b75a9d2a7..2b2f6a351 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -12,3 +12,4 @@ else if(userInput === adminPassword){ else{ response="Incorrect password!"; } +console.log(response); \ No newline at end of file From 3a1178c5b0e40d2d10bab450ea1f10ed5c3c04e1 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 08:16:59 +0100 Subject: [PATCH 25/81] Change response declaration from const to let in passwordChecker.js --- prep/passwordChecker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js index 2b2f6a351..7a67f0f6a 100644 --- a/prep/passwordChecker.js +++ b/prep/passwordChecker.js @@ -1,7 +1,7 @@ const password="secretword123"; const userInput="thisiswrong"; const adminPassword="override"; -const response=""; +let response=""; if(userInput === password){ console.log("Correct password entered"); From c984e1ab230cbee7f33132a4173d6b2466898131 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 09:28:19 +0100 Subject: [PATCH 26/81] Add console log for count variable in 1-count.js --- Sprint-2/1-key-exercises/1-count.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..b823e3e6f 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,3 +4,4 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing +console.log(count); \ No newline at end of file From ac61856be3bc518b275806b5b0bb88b82f8cff43 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 09:37:35 +0100 Subject: [PATCH 27/81] Add detailed comments explaining count variable increment in 1-count.js --- Sprint-2/1-key-exercises/1-count.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index b823e3e6f..49261575c 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,4 +4,9 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing -console.log(count); \ No newline at end of file +console.log(count); + +//Line 3 is reading the current value of , which is <0>, and computing , which turns out to be 1. +//It also assigns the new value <1> to the variable , overwriting the initial value <0>. +//The assignment operator "=" means, take the value on the right, and store it in the variable on the left. +//Console.log(count) prints out the result of Line 3. \ No newline at end of file From d233466bab27603ed94697c2bf9c0ba88b024f44 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 09:56:55 +0100 Subject: [PATCH 28/81] Implement initials extraction from first, middle, and last names in 2-initials.js --- Sprint-2/1-key-exercises/2-initials.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 964c9563c..aba2b6651 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -5,6 +5,4 @@ const lastName = "Johnson"; // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. -const initials = ``; - -// https://www.google.com/search?q=get+first+character+of+string+mdn +const initials = `${firstName[0]} ${middleName[0]} ${lastName[0]} `; From ccf1a795a6a614d575c331d6bb3c1967bef5225e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 09:57:28 +0100 Subject: [PATCH 29/81] Add console log to display initials in 2-initials.js --- Sprint-2/1-key-exercises/2-initials.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index aba2b6651..e67221b53 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -6,3 +6,5 @@ const lastName = "Johnson"; // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. const initials = `${firstName[0]} ${middleName[0]} ${lastName[0]} `; + +console.log(initials); From 6dbe2c4ccd55457f898accb75ee7116098bd0f36 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 10:00:46 +0100 Subject: [PATCH 30/81] Fix comment formatting for clarity in 1-count.js --- Sprint-2/1-key-exercises/1-count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 49261575c..68b926dc8 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -6,7 +6,7 @@ count = count + 1; // Describe what line 3 is doing, in particular focus on what = is doing console.log(count); -//Line 3 is reading the current value of , which is <0>, and computing , which turns out to be 1. +//Line 3 reads the current value of , which is <0>, and computes , which turns out to be 1. //It also assigns the new value <1> to the variable , overwriting the initial value <0>. //The assignment operator "=" means, take the value on the right, and store it in the variable on the left. //Console.log(count) prints out the result of Line 3. \ No newline at end of file From 15f4a87ecb4cbfa0a37afbef9180d9f53ed34ffa Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 15:02:59 +0100 Subject: [PATCH 31/81] Add solution comment for clarity in 2-initials.js --- Sprint-2/1-key-exercises/2-initials.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index e67221b53..e9cf2a40e 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -5,6 +5,7 @@ const lastName = "Johnson"; // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. +//Solution const initials = `${firstName[0]} ${middleName[0]} ${lastName[0]} `; console.log(initials); From 4eede605451be944bf4a6340522e0395a9f3f5d3 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 15:51:05 +0100 Subject: [PATCH 32/81] Implement dir extraction from filePath and log the result in 3-paths.js --- Sprint-2/1-key-exercises/3-paths.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..377942753 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,9 @@ console.log(`The base part of ${filePath} is ${base}`); // Create a variable to store the dir part of the filePath variable // Create a variable to store the ext part of the variable -const dir = ; +const dir = filePath.slice(0, lastSlashIndex); +console.log(`The dir part of ${filePath} is ${dir}`); + const ext = ; // https://www.google.com/search?q=slice+mdn \ No newline at end of file From 70f82303bec9c7332f8b470c730c93c012163f7b Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 17:10:34 +0100 Subject: [PATCH 33/81] Add variable assignment and Implement ext extraction logic in 3-paths.js --- Sprint-2/1-key-exercises/3-paths.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 377942753..bf9d018e9 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,9 +17,11 @@ console.log(`The base part of ${filePath} is ${base}`); // Create a variable to store the dir part of the filePath variable // Create a variable to store the ext part of the variable +//Solution const dir = filePath.slice(0, lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); -const ext = ; +const lastDotIndex = base.lastIndexOf("."); +const ext = base.slice(lastDotIndex); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From df08e0a2589ec69df6b59e8375b7754b5c9b6824 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 17:11:55 +0100 Subject: [PATCH 34/81] Add console log to display file extension in 3-paths.js --- Sprint-2/1-key-exercises/3-paths.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index bf9d018e9..79b5b26de 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -23,5 +23,6 @@ console.log(`The dir part of ${filePath} is ${dir}`); const lastDotIndex = base.lastIndexOf("."); const ext = base.slice(lastDotIndex); +console.log(`The ext part of ${filePath} is ${ext}`); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From 298f6d8f70b90176e1caa41d8c7673ff994694d9 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 17:39:23 +0100 Subject: [PATCH 35/81] Add solution comment for clarity in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..ab217fbad 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -7,3 +7,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // Try breaking down the expression and using documentation to explain what it means // It will help to think about the order in which expressions are evaluated // Try logging the value of num and running the program several times to build an idea of what the program is doing + +//Solution From f29149595e81cf6833dbe655f26cc0546b60d3a3 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 17:48:58 +0100 Subject: [PATCH 36/81] Add clarification comment for "num" in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index ab217fbad..4c1732b13 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -9,3 +9,4 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // Try logging the value of num and running the program several times to build an idea of what the program is doing //Solution +//- "num" represents a random whole number between 1 and 100. \ No newline at end of file From e1edb497bd1a107ead537790f17fa338bfeaa118 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 17:52:14 +0100 Subject: [PATCH 37/81] Add breakdown comment in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 4c1732b13..172a6a427 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -9,4 +9,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // Try logging the value of num and running the program several times to build an idea of what the program is doing //Solution -//- "num" represents a random whole number between 1 and 100. \ No newline at end of file +//- "num" represents a random whole number between 1 and 100. +//Break down of expression \ No newline at end of file From cf881622f9a84b5da7969858912c6b5634392ee6 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 17:55:07 +0100 Subject: [PATCH 38/81] Add detailed breakdown comment for Math.random in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 172a6a427..917715fac 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -10,4 +10,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; //Solution //- "num" represents a random whole number between 1 and 100. -//Break down of expression \ No newline at end of file +//Break down of expression +//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.87). \ No newline at end of file From de4738fab716abffa72f522ffdebf95f21a54f79 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 18:03:34 +0100 Subject: [PATCH 39/81] Add additional breakdown comments in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 917715fac..e79e5cec1 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -11,4 +11,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; //Solution //- "num" represents a random whole number between 1 and 100. //Break down of expression -//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.87). \ No newline at end of file +//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.87). +//-(maximum - minimum + 1): +// This expression can be simplified as (100 - 1 + 1), which equals 100. This tells the program how many possible whole numbers there are. There are 100 possibilities. +// The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99. \ No newline at end of file From d93a91df0a172be06837a7092add081c9c363e80 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 18:18:49 +0100 Subject: [PATCH 40/81] Add additional breakdown comments in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index e79e5cec1..3e133f4bf 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -11,7 +11,10 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; //Solution //- "num" represents a random whole number between 1 and 100. //Break down of expression -//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.87). +//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.876). //-(maximum - minimum + 1): // This expression can be simplified as (100 - 1 + 1), which equals 100. This tells the program how many possible whole numbers there are. There are 100 possibilities. -// The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99. \ No newline at end of file +// The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99. +//-Math.random() * (maximum - minimum + 1): +// This function multiplies the random fraction by the range size. Since Math.random() represents numbers >=0 and <1, this expression produces value anywhere from 0 up to 100, excluding 100. +// Example to justify expression: 0.876 * 100 = 87.6 \ No newline at end of file From 20ea3646c20e9da0d222d59d8b6642f909cedb78 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 18:31:23 +0100 Subject: [PATCH 41/81] Add breakdown comments for Math.floor in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 3e133f4bf..c5a017612 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -16,5 +16,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // This expression can be simplified as (100 - 1 + 1), which equals 100. This tells the program how many possible whole numbers there are. There are 100 possibilities. // The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99. //-Math.random() * (maximum - minimum + 1): -// This function multiplies the random fraction by the range size. Since Math.random() represents numbers >=0 and <1, this expression produces value anywhere from 0 up to 100, excluding 100. -// Example to justify expression: 0.876 * 100 = 87.6 \ No newline at end of file +// This function multiplies the random decimal by the range size. Since Math.random() represents numbers >=0 and <1, this expression produces value anywhere from 0 up to 100, excluding 100. +// Example to justify expression: 0.876 * 100 = 87.6 +//-Math.floor: This static method rounds down to the nearest whole number, discarding the decimal. This turns the continuous range into whole numbers, from 0 - 99. +// That is 87.6 becomes 87. \ No newline at end of file From e10fbf996f79d7e4c854e7b07351e87ae37a24e0 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 18:41:39 +0100 Subject: [PATCH 42/81] Add explanation for shifting range in random number generation --- Sprint-2/1-key-exercises/4-random.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index c5a017612..7efd397b6 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -19,4 +19,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // This function multiplies the random decimal by the range size. Since Math.random() represents numbers >=0 and <1, this expression produces value anywhere from 0 up to 100, excluding 100. // Example to justify expression: 0.876 * 100 = 87.6 //-Math.floor: This static method rounds down to the nearest whole number, discarding the decimal. This turns the continuous range into whole numbers, from 0 - 99. -// That is 87.6 becomes 87. \ No newline at end of file +// That is 87.6 becomes 87. +// + minimum: This shifts the whole range up by adding 1. So instead of landing on 0 - 99, we have 1 - 100. \ No newline at end of file From 57981df3fd2ac10aa9ebfe303b3c125ad1ec5f3f Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 18:43:28 +0100 Subject: [PATCH 43/81] Add console log for generated random number in 4-random.js --- Sprint-2/1-key-exercises/4-random.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 7efd397b6..9c1b38754 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -2,7 +2,7 @@ const minimum = 1; const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; - +console.log(num); // In this exercise, you will need to work out what num represents? // Try breaking down the expression and using documentation to explain what it means // It will help to think about the order in which expressions are evaluated From 6ac46a68107b78b1f45a5482d40007e2506d3330 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 18:45:19 +0100 Subject: [PATCH 44/81] Refactor comments in 4-random.js for readability --- Sprint-2/1-key-exercises/4-random.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 9c1b38754..b524e6443 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -3,21 +3,23 @@ const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; console.log(num); -// In this exercise, you will need to work out what num represents? -// Try breaking down the expression and using documentation to explain what it means -// It will help to think about the order in which expressions are evaluated -// Try logging the value of num and running the program several times to build an idea of what the program is doing + //Solution //- "num" represents a random whole number between 1 and 100. + //Break down of expression //-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.876). + //-(maximum - minimum + 1): // This expression can be simplified as (100 - 1 + 1), which equals 100. This tells the program how many possible whole numbers there are. There are 100 possibilities. // The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99. + //-Math.random() * (maximum - minimum + 1): // This function multiplies the random decimal by the range size. Since Math.random() represents numbers >=0 and <1, this expression produces value anywhere from 0 up to 100, excluding 100. // Example to justify expression: 0.876 * 100 = 87.6 + //-Math.floor: This static method rounds down to the nearest whole number, discarding the decimal. This turns the continuous range into whole numbers, from 0 - 99. // That is 87.6 becomes 87. + // + minimum: This shifts the whole range up by adding 1. So instead of landing on 0 - 99, we have 1 - 100. \ No newline at end of file From 0175ffcefc5e9f4d9bdb0446581891a552132e23 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 21:53:54 +0100 Subject: [PATCH 45/81] Wrap instructional lines in multi-line comment and add solution explanation --- Sprint-2/2-mandatory-errors/0.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index cf6c5039f..78f92a707 100644 --- a/Sprint-2/2-mandatory-errors/0.js +++ b/Sprint-2/2-mandatory-errors/0.js @@ -1,2 +1,5 @@ -This is just an instruction for the first activity - but it is just for human consumption -We don't want the computer to run these 2 lines - how can we solve this problem? \ No newline at end of file +/*This is just an instruction for the first activity - but it is just for human consumption +We don't want the computer to run these 2 lines - how can we solve this problem?*/ + +//Solution +//This problem was solved by wrapping the statement in a multi-line comment tag. This way the lines are stopped from executing. \ No newline at end of file From 05aa2b7b4cef7458304671fa9f84608dd081dc6e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 21:58:31 +0100 Subject: [PATCH 46/81] Change age variable from const to let for reassignment --- Sprint-2/2-mandatory-errors/1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..031839b47 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,4 +1,4 @@ // trying to create an age variable and then reassign the value by 1 -const age = 33; +let age = 33; age = age + 1; From 15a4e9a8f941e902fa43fec0f876d8938d48afb7 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 21:59:22 +0100 Subject: [PATCH 47/81] Add console log for updated age variable --- Sprint-2/2-mandatory-errors/1.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 031839b47..6ef2ea979 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -2,3 +2,5 @@ let age = 33; age = age + 1; + +console.log(age); From 557caf0745bdd2b0c38f40021121d4924c313b0e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:04:00 +0100 Subject: [PATCH 48/81] Add reference error comment for cityOfBirth initialization issue --- Sprint-2/2-mandatory-errors/2.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..2d573200d 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -3,3 +3,5 @@ console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; + +//ReferenceError: Cannot access 'cityOfBirth' before initialization. From 08f2261dfd08d6a9c4b24d655916a9b2595b7a6a Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:06:15 +0100 Subject: [PATCH 49/81] Add explanation comment for cityOfBirth reference error --- Sprint-2/2-mandatory-errors/2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 2d573200d..9a2945737 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -5,3 +5,4 @@ console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; //ReferenceError: Cannot access 'cityOfBirth' before initialization. +//console.log tries to use cityOfBirth inside the template literal, but cityOfBirth has not been declared yet at that point in the code. From 1d0d8760942cce092c8edf17404b9d72855d49fc Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:08:45 +0100 Subject: [PATCH 50/81] Fix ReferenceError by declaring cityOfBirth before initializing console.log --- Sprint-2/2-mandatory-errors/2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 9a2945737..047143147 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -1,8 +1,9 @@ // Currently trying to print the string "I was born in Bolton" but it isn't working... // what's the error ? -console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +console.log(`I was born in ${cityOfBirth}`); + //ReferenceError: Cannot access 'cityOfBirth' before initialization. //console.log tries to use cityOfBirth inside the template literal, but cityOfBirth has not been declared yet at that point in the code. From c4049e2ea60c6e95e63a4e98fbb18c7b5eee082e Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:22:37 +0100 Subject: [PATCH 51/81] Add prediction and explanation comments for cardNumber slicing issue --- Sprint-2/2-mandatory-errors/3.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..40caf2f8b 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -7,3 +7,8 @@ const last4Digits = cardNumber.slice(-4); // Then run the code and see what error it gives. // Consider: Why does it give this error? Is this what I predicted? If not, what's different? // Then try updating the expression last4Digits is assigned to, in order to get the correct value + + +//Solution +//Prediction - The code would not run because 'cardNumber' is declared as numbers instead of a string. +// The '.slice()' method belongs to strings and arrays, it could only work by treating it's subject as a sequence of characters. \ No newline at end of file From 466f6521243a8eee800d2fde3c5642e02ea62216 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:23:47 +0100 Subject: [PATCH 52/81] Add console log for last4Digits --- Sprint-2/2-mandatory-errors/3.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 40caf2f8b..5db269018 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -11,4 +11,6 @@ const last4Digits = cardNumber.slice(-4); //Solution //Prediction - The code would not run because 'cardNumber' is declared as numbers instead of a string. -// The '.slice()' method belongs to strings and arrays, it could only work by treating it's subject as a sequence of characters. \ No newline at end of file +// The '.slice()' method belongs to strings and arrays, it could only work by treating it's subject as a sequence of characters. + +console.log(last4Digits); \ No newline at end of file From 4c83857c8e176f6bde7210275ca7b856548b4b90 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:32:13 +0100 Subject: [PATCH 53/81] Add error message and explanation for cardNumber slicing issue --- Sprint-2/2-mandatory-errors/3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 5db269018..0af492bec 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -13,4 +13,9 @@ const last4Digits = cardNumber.slice(-4); //Prediction - The code would not run because 'cardNumber' is declared as numbers instead of a string. // The '.slice()' method belongs to strings and arrays, it could only work by treating it's subject as a sequence of characters. -console.log(last4Digits); \ No newline at end of file +console.log(last4Digits); + +//Error message - TypeError: cardNumber.slice is not a function +//Reason for error +//The error thrown was considerably as predicted. +//'.slice()' is a method defined on 'String.prototype', and since 'cardNumber' was declared with a numeric literal, JavaScript treats it as the 'number' type. \ No newline at end of file From 3fe8bc3870d6221814c1de0e21176eb0ffd02d8f Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:34:32 +0100 Subject: [PATCH 54/81] Fix last4Digits assignment by converting cardNumber to string for slicing --- Sprint-2/2-mandatory-errors/3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 0af492bec..c7523234d 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,5 +1,5 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +const last4Digits = String(cardNumber).slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working From d65f2ebb7834608d3626eee768cfd51b856c6a72 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:43:02 +0100 Subject: [PATCH 55/81] Add console log for 12-hour and 24-hour clock times --- Sprint-2/2-mandatory-errors/4.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..a132645fd 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,4 @@ const 12HourClockTime = "8:53pm"; const 24hourClockTime = "20:53"; + +console.log(12HourClockTime, 24hourClockTime); \ No newline at end of file From 0c7b74938230971aa5857711c2ef93d1bbd02325 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:46:54 +0100 Subject: [PATCH 56/81] Add comments explaining SyntaxError due to invalid identifier names --- Sprint-2/2-mandatory-errors/4.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index a132645fd..c32b620f3 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,4 +1,7 @@ const 12HourClockTime = "8:53pm"; const 24hourClockTime = "20:53"; -console.log(12HourClockTime, 24hourClockTime); \ No newline at end of file +console.log(12HourClockTime, 24hourClockTime); + +//There is a SyntaxError after running the code. +//This error occurred because the identifiers '12HourClockTime' and '24hourClockTime' both start with a digit. \ No newline at end of file From 54865667bdc08fee39b25cd6fdf1bb19272a9848 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 22:49:12 +0100 Subject: [PATCH 57/81] Fix variable names by renaming identifiers starting with digits --- Sprint-2/2-mandatory-errors/4.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index c32b620f3..7d7f9e10b 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,7 +1,7 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const ClockTime12Hour = "8:53pm"; +const ClockTime24hour = "20:53"; -console.log(12HourClockTime, 24hourClockTime); +console.log(ClockTime12Hour, ClockTime24hour); //There is a SyntaxError after running the code. //This error occurred because the identifiers '12HourClockTime' and '24hourClockTime' both start with a digit. \ No newline at end of file From b23cf154c1a0f105d4e5cd8d53c963144c2a7f6a Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 23:37:15 +0100 Subject: [PATCH 58/81] Add solution comments detailing function calls in 1-percentage-change.js --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index e24ecb8e1..fa6b489bf 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -20,3 +20,12 @@ console.log(`The percentage change is ${percentageChange}`); // d) Identify all the lines that are variable declarations // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? + + +//Solution +// a) There are 5 function calls on lines 4, 5, and 9. +// Line 4: carPrice.replaceAll(",","") +// Line 4: Number() +// Line 5: priceAfterOneYear.replaceAll("," "") +// Line 5: Number() +// Line 9: console.log() \ No newline at end of file From 84c9f966ccdc4727b0e41c9e38be25ac758e9f51 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 23:44:34 +0100 Subject: [PATCH 59/81] Add error explanation in 1-percentage-change.js --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index fa6b489bf..d18e52e54 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -28,4 +28,8 @@ console.log(`The percentage change is ${percentageChange}`); // Line 4: Number() // Line 5: priceAfterOneYear.replaceAll("," "") // Line 5: Number() -// Line 9: console.log() \ No newline at end of file +// Line 9: console.log() + +// b) Line 5 seems to broken. +// Error message - SyntaxError: missing ) after argument list +// Reason for error: There is a missing comma between two arguments of replaceAll. \ No newline at end of file From f4a107a60c7037eb33a5ae33658b1f490572c859 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 23:46:53 +0100 Subject: [PATCH 60/81] Add error resolution comment for SyntaxError in 1-percentage-change.js --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index d18e52e54..417143af9 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -32,4 +32,5 @@ console.log(`The percentage change is ${percentageChange}`); // b) Line 5 seems to broken. // Error message - SyntaxError: missing ) after argument list -// Reason for error: There is a missing comma between two arguments of replaceAll. \ No newline at end of file +// Reason for error: There is a missing comma between two arguments of replaceAll. +// To fix the error, we need to add the missing comma between the arguments of replaceAll. \ No newline at end of file From 37cab85b585bd0d533fa90f4e98f8d4f8b65ef34 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 23:47:49 +0100 Subject: [PATCH 61/81] Fix syntax error by adding missing comma in replaceAll function call for priceAfterOneYear --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 417143af9..8cc080b1f 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -2,7 +2,7 @@ let carPrice = "10,000"; let priceAfterOneYear = "8,543"; carPrice = Number(carPrice.replaceAll(",", "")); -priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); +priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); const priceDifference = carPrice - priceAfterOneYear; const percentageChange = (priceDifference / carPrice) * 100; From 9e31bebbc029c0765aa41cbe18002a6edce20e32 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 23:53:08 +0100 Subject: [PATCH 62/81] Add comments for variable reassignment statements in 1-percentage-change.js --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 8cc080b1f..0a72d7a90 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -33,4 +33,8 @@ console.log(`The percentage change is ${percentageChange}`); // b) Line 5 seems to broken. // Error message - SyntaxError: missing ) after argument list // Reason for error: There is a missing comma between two arguments of replaceAll. -// To fix the error, we need to add the missing comma between the arguments of replaceAll. \ No newline at end of file +// To fix the error, we need to add the missing comma between the arguments of replaceAll. + +// c) Lines 4 and 5 contain variable reassignment statements +// Line 4: carPrice = Number() +// Line 5: priceAfterOneYear = Number() \ No newline at end of file From 0a35180155961cb18ac8a8e909abfeff4c5c28a7 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Wed, 16 Sep 2026 23:59:38 +0100 Subject: [PATCH 63/81] Add comments for variable declarations in 1-percentage-change.js --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 0a72d7a90..abdce4af8 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -37,4 +37,10 @@ console.log(`The percentage change is ${percentageChange}`); // c) Lines 4 and 5 contain variable reassignment statements // Line 4: carPrice = Number() -// Line 5: priceAfterOneYear = Number() \ No newline at end of file +// Line 5: priceAfterOneYear = Number() + +// d) Lines 1, 2, 7, and 8 contain variable declarations +// Line 1: let carPrice = "10,000"; +// Line 2: let priceAfterOneYear = "8,543"; +// Line 7: const priceDifference = carPrice - priceAfterOneYear; +// Line 8: const percentageChange = (priceDifference / carPrice) * 100; \ No newline at end of file From 722ed1c8cb6aef1d355cc9b1e79a110254045ade Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 00:24:31 +0100 Subject: [PATCH 64/81] Add detailed explanation for Number conversion in 1-percentage-change.js --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index abdce4af8..2bfa87260 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -43,4 +43,10 @@ console.log(`The percentage change is ${percentageChange}`); // Line 1: let carPrice = "10,000"; // Line 2: let priceAfterOneYear = "8,543"; // Line 7: const priceDifference = carPrice - priceAfterOneYear; -// Line 8: const percentageChange = (priceDifference / carPrice) * 100; \ No newline at end of file +// Line 8: const percentageChange = (priceDifference / carPrice) * 100; + +// e) Number(carPrice.replaceAll(",","")) is two steps combined, whereby: +// carPrice.replaceAll(",","") takes the string "10,000" and deletes every comma, making it 10000 +// and Number() converts the new string into an actual numeric value +// The purpose of the expression is to strip out the formatting comma first from the string +// so that JavaScript does not treat it as plain text, and then converts the result into real numbers for it to be used in math, similar to Line 7 \ No newline at end of file From 41ef6029c51da51bf40d07e7fd6e73c3d486997d Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 08:49:24 +0100 Subject: [PATCH 65/81] Add solution comments for variable declarations in 2-time-format.js --- Sprint-2/3-mandatory-interpret/2-time-format.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 47d239558..c64ef0fb9 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -23,3 +23,14 @@ console.log(result); // e) What do you think the variable result represents? Can you think of a better name for this variable? // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer + + + +//Solution +// a) There are 6 declared variables in this program, all declared with 'const' +// - const movieLength +// - const remainingSeconds +// - const totalMinutes +// - const remainingMinutes +// - const totalHours +// - const result \ No newline at end of file From b9beadcb7e9e0b4cd7096e36f39743589d0c1634 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 08:51:36 +0100 Subject: [PATCH 66/81] Add explanation for function call in 2-time-format.js --- Sprint-2/3-mandatory-interpret/2-time-format.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index c64ef0fb9..6be5aee4a 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -33,4 +33,6 @@ console.log(result); // - const totalMinutes // - const remainingMinutes // - const totalHours -// - const result \ No newline at end of file +// - const result + +// b) There is just 1 function call: console.log(result); \ No newline at end of file From b96468b23fdfc387b7ba5481ceb2cf675bc67299 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 09:07:46 +0100 Subject: [PATCH 67/81] Add detailed explanation for remainder operator in 2-time-format.js --- Sprint-2/3-mandatory-interpret/2-time-format.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 6be5aee4a..faa909f09 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -35,4 +35,8 @@ console.log(result); // - const totalHours // - const result -// b) There is just 1 function call: console.log(result); \ No newline at end of file +// b) There is just 1 function call: console.log(result); + +// c) In the expression 'movieLength % 60', '%' represents the remainder operator. It returns the value that of what is left over after dividing the left operand by the right operand as many whole times as possible. +// Since movieLength = 8784, it means: 8784 % 60, which returns a result of 146 remainder 24. +// Therefore, movieLength % 60 (8784 % 60) returns the leftover value '24'. In this context, the leftover represents the loose seconds that add up to a full minute. \ No newline at end of file From d6a7f93cc04629a1323e34e7c9894e1a7e44d7ad Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 09:31:58 +0100 Subject: [PATCH 68/81] Add explanation for totalMinutes calculation in 2-time-format.js --- Sprint-2/3-mandatory-interpret/2-time-format.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index faa909f09..0da1aded6 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -39,4 +39,9 @@ console.log(result); // c) In the expression 'movieLength % 60', '%' represents the remainder operator. It returns the value that of what is left over after dividing the left operand by the right operand as many whole times as possible. // Since movieLength = 8784, it means: 8784 % 60, which returns a result of 146 remainder 24. -// Therefore, movieLength % 60 (8784 % 60) returns the leftover value '24'. In this context, the leftover represents the loose seconds that add up to a full minute. \ No newline at end of file +// Therefore, movieLength % 60 (8784 % 60) returns the leftover value '24'. In this context, the leftover represents the loose seconds that add up to a full minute. + +// d) The expression assigned to totalMinutes simply means, we subtract the loose seconds, '24', from movieLength, '8784'. The result becomes a number easily divisible by 60 +// That is: totalMinutes = (8784 - 24); +// which gives 8760, and then divides it 60; +// the result, 146, is the total number of complete minutes contained in the movie \ No newline at end of file From 179fcb4fe521ad6b617f3844611af0edb310e843 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 11:43:29 +0100 Subject: [PATCH 69/81] Add explanation for totalMinutes calculation, result meaning and suggest better variable name for result in 2-time-format.js --- Sprint-2/3-mandatory-interpret/2-time-format.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 0da1aded6..dafb55fb7 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -44,4 +44,7 @@ console.log(result); // d) The expression assigned to totalMinutes simply means, we subtract the loose seconds, '24', from movieLength, '8784'. The result becomes a number easily divisible by 60 // That is: totalMinutes = (8784 - 24); // which gives 8760, and then divides it 60; -// the result, 146, is the total number of complete minutes contained in the movie \ No newline at end of file +// the result, 146, is the total number of complete minutes contained in the movie + +// e) The variable 'result' is a template literal syntax which holds the movie's length formatted as a colon-separated time string: as in '2:26:24'. +// A better name for 'result' could have been 'movieLengthDisplay' \ No newline at end of file From 2926cd853cfe8cd3a48e2069b3b648d729fdaa32 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 11:54:33 +0100 Subject: [PATCH 70/81] Refactor convert function to encapsulate logic and test with various inputs --- Sprint-2/3-mandatory-interpret/2-time-format.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index dafb55fb7..5274489ee 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -1,4 +1,5 @@ -const movieLength = 8784; // length of movie in seconds +//const movieLength = 8784; // length of movie in seconds +function convert(movieLength){ const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -8,6 +9,11 @@ const totalHours = (totalMinutes - remainingMinutes) / 60; const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; console.log(result); +} + +[65, -100, 90.5, "8784"].forEach(v => { + console.log(v, "->", convert(v)); +}); // For the piece of code above, read the code and then answer the following questions @@ -47,4 +53,5 @@ console.log(result); // the result, 146, is the total number of complete minutes contained in the movie // e) The variable 'result' is a template literal syntax which holds the movie's length formatted as a colon-separated time string: as in '2:26:24'. -// A better name for 'result' could have been 'movieLengthDisplay' \ No newline at end of file +// A better name for 'result' could have been 'movieLengthDisplay' + From 01db8a2580bc4c482eadce682cd76d59f9a8ee32 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 11:59:51 +0100 Subject: [PATCH 71/81] Refactor convert function to return formatted time instead of logging it --- Sprint-2/3-mandatory-interpret/2-time-format.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 5274489ee..0b9d32ed9 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -7,8 +7,9 @@ const totalMinutes = (movieLength - remainingSeconds) / 60; const remainingMinutes = totalMinutes % 60; const totalHours = (totalMinutes - remainingMinutes) / 60; -const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; -console.log(result); +return `${totalHours}:${remainingMinutes}:${remainingSeconds}`; +//const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; +//console.log(result); } [65, -100, 90.5, "8784"].forEach(v => { From 6f6bcad31a6aad61f3fec8f4355dc5da3048f44a Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Thu, 17 Sep 2026 12:32:10 +0100 Subject: [PATCH 72/81] Add notes on limitations of movieLength handling in convert function --- Sprint-2/3-mandatory-interpret/2-time-format.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 0b9d32ed9..685f7b52b 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -56,3 +56,9 @@ return `${totalHours}:${remainingMinutes}:${remainingSeconds}`; // e) The variable 'result' is a template literal syntax which holds the movie's length formatted as a colon-separated time string: as in '2:26:24'. // A better name for 'result' could have been 'movieLengthDisplay' +// f) This program did not work for all values of movieLength +// Some problems discovered +// - for movieLength 65 there was an issue with zero-padding, '65' becomes '0:1:5' instead of the conventional '00:01:05'. Returning single-digit minutes/seconds look wrong in a real time display +// - negative integer, '-100', produced '0:-1:-40', which is inaccurate for a duration +// - non-integer input, 90.5, was not handled as it gives '0:1:30.5'. This implies that a fractional second had slipped through untouched, since nothing was truncated. +// - string input "8784" works here because operators '%', '-', and '/' automatically converts strings to numbers, but that is fragile and relies on the type conversion rather than actual input validation \ No newline at end of file From ea7dbc1f3c4af7d87e0877fa294b72ebbc4aa1e0 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 15:47:58 +0100 Subject: [PATCH 73/81] Add detailed explanation for penceStringWithoutTrailingP processing in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..ccf03ba10 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -25,3 +25,9 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" + +// 2. const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1); +// substring(0, length - 1): is a method that is invoked in the paragraph above to take every character in the string provided except the last one, leaving out the 'p' +// That is -> '399p' becomes '399' +// const penceStringWithoutTrailingP: used to store the value from 'penceString.substring(...)' + From 893336e923f9951f55e456219ad44c4b3d637625 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 16:14:51 +0100 Subject: [PATCH 74/81] Add detailed explanation for paddedPenceNumberString processing in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index ccf03ba10..8ff863962 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -30,4 +30,8 @@ console.log(`£${pounds}.${pence}`); // substring(0, length - 1): is a method that is invoked in the paragraph above to take every character in the string provided except the last one, leaving out the 'p' // That is -> '399p' becomes '399' // const penceStringWithoutTrailingP: used to store the value from 'penceString.substring(...)' - + +// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); +// penceStringWithoutTrailingP is now '399' +// padStart(3, "0") is a method which guarantees that the numeric string is at least 3 characters long, and if it is shorter add '0' to the front until it is 3 characters long. +// padding to 3 ensures there is always at least one pounds digit and two pence digits. From 6468f298a1813573e0b4bbda56aafd01af82cfbf Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 16:46:00 +0100 Subject: [PATCH 75/81] Add detailed explanation for pounds extraction in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 8ff863962..4b1fa7845 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -33,5 +33,11 @@ console.log(`£${pounds}.${pence}`); // 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // penceStringWithoutTrailingP is now '399' -// padStart(3, "0") is a method which guarantees that the numeric string is at least 3 characters long, and if it is shorter add '0' to the front until it is 3 characters long. +// padStart(3, "0") is a method used above which guarantees that the numeric string is at least 3 characters long, and if it is shorter add '0' to the front until it is 3 characters long. // padding to 3 ensures there is always at least one pounds digit and two pence digits. + +// 4. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); +// since paddedPenceNumberString is '399' and it's '.length' is 3 +// this line is saying: '399.substring(0, 3 - 2)', which becomes '399.substring(0, 1)' +// 'substring' is a method used to grab characters from a string, starting from the left, from position '0' up to, but not including, position '1' +// 'const pounds' would be assigned the new value: '3' \ No newline at end of file From 2baa16af5e983798a304c8bc799bcc283a72fc5d Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 17:18:13 +0100 Subject: [PATCH 76/81] Add detailed explanation for pence calculation in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 4b1fa7845..3b4d98f73 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -35,9 +35,17 @@ console.log(`£${pounds}.${pence}`); // penceStringWithoutTrailingP is now '399' // padStart(3, "0") is a method used above which guarantees that the numeric string is at least 3 characters long, and if it is shorter add '0' to the front until it is 3 characters long. // padding to 3 ensures there is always at least one pounds digit and two pence digits. +// // 4. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); // since paddedPenceNumberString is '399' and it's '.length' is 3 // this line is saying: '399.substring(0, 3 - 2)', which becomes '399.substring(0, 1)' // 'substring' is a method used to grab characters from a string, starting from the left, from position '0' up to, but not including, position '1' -// 'const pounds' would be assigned the new value: '3' \ No newline at end of file +// 'const pounds' would be assigned the new value: '3' + +// 5. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); +// since paddedPenceNumberString.length is '3' +// then 'paddedPenceNumberString.substring(3 - 2)' becomes 'paddedPenceNumberString.substring(1)': this means grab everything from position '1' of the string to the end. +// That is -> '399.substring(1)' becomes '99' +// '.padEnd(2, "0") is another method that ensures the string is at least 2 characters long and adding '0' to the end if it's too short. +// 'const pence' would be assigned the new value: '99' \ No newline at end of file From fdcbeb0a1f51d147c00c81565aaf32462cfad579 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 17:22:22 +0100 Subject: [PATCH 77/81] Clarify explanation for paddedPenceNumberString processing in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 3b4d98f73..6bef6e1de 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -34,7 +34,7 @@ console.log(`£${pounds}.${pence}`); // 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // penceStringWithoutTrailingP is now '399' // padStart(3, "0") is a method used above which guarantees that the numeric string is at least 3 characters long, and if it is shorter add '0' to the front until it is 3 characters long. -// padding to 3 ensures there is always at least one pounds digit and two pence digits. +// padding to 3 ensures there is always at least 3 digits, that is, one pounds digit and two pence digits. // // 4. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); From 105bbf8b8518e281276f1f569f46a87d8e3a5baa Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 17:41:49 +0100 Subject: [PATCH 78/81] Add explanation for pence calculation in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 6bef6e1de..41a21d282 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -48,4 +48,6 @@ console.log(`£${pounds}.${pence}`); // then 'paddedPenceNumberString.substring(3 - 2)' becomes 'paddedPenceNumberString.substring(1)': this means grab everything from position '1' of the string to the end. // That is -> '399.substring(1)' becomes '99' // '.padEnd(2, "0") is another method that ensures the string is at least 2 characters long and adding '0' to the end if it's too short. -// 'const pence' would be assigned the new value: '99' \ No newline at end of file +// 'const pence' would be assigned the new value: '99' + +// 6. console.log(`$) \ No newline at end of file From c524311882ae4a283d4aa892ddcf10ce8132d170 Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 17:42:34 +0100 Subject: [PATCH 79/81] Add explanation for final output in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 41a21d282..f0b3449f6 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -50,4 +50,5 @@ console.log(`£${pounds}.${pence}`); // '.padEnd(2, "0") is another method that ensures the string is at least 2 characters long and adding '0' to the end if it's too short. // 'const pence' would be assigned the new value: '99' -// 6. console.log(`$) \ No newline at end of file +// 6. console.log(`£${pounds}.${pence}`): This template string calls the result of two pieces, 'pounds' which is '3' and 'pence' which '99' +// Overall result: £3.99 \ No newline at end of file From 361a9e732f29c8a6734a76354ac1204e293f8a0b Mon Sep 17 00:00:00 2001 From: Precious Moses Date: Fri, 18 Sep 2026 17:45:22 +0100 Subject: [PATCH 80/81] Clarify explanation for substring method in pounds extraction in 3-to-pounds.js --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index f0b3449f6..13105bec1 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -40,7 +40,7 @@ console.log(`£${pounds}.${pence}`); // 4. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); // since paddedPenceNumberString is '399' and it's '.length' is 3 // this line is saying: '399.substring(0, 3 - 2)', which becomes '399.substring(0, 1)' -// 'substring' is a method used to grab characters from a string, starting from the left, from position '0' up to, but not including, position '1' +// 'substring' is a method used to grab characters from this string, starting from the left, from position '0' up to, but not including, position '1' // 'const pounds' would be assigned the new value: '3' // 5. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); From 4253d8f191715c4d382bc000861fb61018eaa229 Mon Sep 17 00:00:00 2001 From: Moses777 Date: Fri, 18 Sep 2026 18:11:16 +0100 Subject: [PATCH 81/81] Delete prep directory --- prep/boolean.js | 17 ----------------- prep/facts.js | 1 - prep/greeting.js | 4 ---- prep/hello_world.js | 1 - prep/passwordChecker.js | 15 --------------- 5 files changed, 38 deletions(-) delete mode 100644 prep/boolean.js delete mode 100644 prep/facts.js delete mode 100644 prep/greeting.js delete mode 100644 prep/hello_world.js delete mode 100644 prep/passwordChecker.js diff --git a/prep/boolean.js b/prep/boolean.js deleted file mode 100644 index a3c3268bc..000000000 --- a/prep/boolean.js +++ /dev/null @@ -1,17 +0,0 @@ -console.log(42 === 10 + 32); - -console.log(10 * 5 === 60); - -console.log("hello" === "hello"); - -console.log("CYF" === "cyf"); - -const homeTown = "Newcastle" -homeTown === "Liverpool" -console.log("homeTown" === "Liverpool") - -console.log(42 === 42) - -console.log(42 === "42") - -console.log(42 == "42") \ No newline at end of file diff --git a/prep/facts.js b/prep/facts.js deleted file mode 100644 index fa5cbb09f..000000000 --- a/prep/facts.js +++ /dev/null @@ -1 +0,0 @@ -console.log("One fun fact about sprints is reading the instructions carefully, and making further research."); \ No newline at end of file diff --git a/prep/greeting.js b/prep/greeting.js deleted file mode 100644 index c13178591..000000000 --- a/prep/greeting.js +++ /dev/null @@ -1,4 +0,0 @@ -let greeting = "Hello there"; -greeting = "Good Morning"; -const name = "Mr Moses"; -console.log(`${greeting}, ${name}!`); \ No newline at end of file diff --git a/prep/hello_world.js b/prep/hello_world.js deleted file mode 100644 index de8882976..000000000 --- a/prep/hello_world.js +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello World!"); \ No newline at end of file diff --git a/prep/passwordChecker.js b/prep/passwordChecker.js deleted file mode 100644 index 7a67f0f6a..000000000 --- a/prep/passwordChecker.js +++ /dev/null @@ -1,15 +0,0 @@ -const password="secretword123"; -const userInput="thisiswrong"; -const adminPassword="override"; -let response=""; - -if(userInput === password){ - console.log("Correct password entered"); -} -else if(userInput === adminPassword){ - console.log("Admin access granted"); -} -else{ - response="Incorrect password!"; -} -console.log(response); \ No newline at end of file