From 285587f8156662df399096c6bc2ac71606555aa9 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Sat, 26 Sep 2026 22:53:37 +0200 Subject: [PATCH 01/34] answered 1-count,js --- Prep | 1 + Sprint-2/1-key-exercises/1-count.js | 2 ++ 2 files changed, 3 insertions(+) create mode 160000 Prep diff --git a/Prep b/Prep new file mode 160000 index 000000000..4035ae055 --- /dev/null +++ b/Prep @@ -0,0 +1 @@ +Subproject commit 4035ae055563c1874746d5640e42517e5dc645ab diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..6b5382e30 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,3 +4,5 @@ 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 + +// = in line 3 is assigning the rule that counting must start at 0. \ No newline at end of file From 647de998c252d2c9001a68d67d8490a3e8d1a08c Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Sat, 26 Sep 2026 23:02:24 +0200 Subject: [PATCH 02/34] added first character variable --- Sprint-2/1-key-exercises/2-initials.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 964c9563c..1cb11e620 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -8,3 +8,7 @@ const lastName = "Johnson"; const initials = ``; // https://www.google.com/search?q=get+first+character+of+string+mdn + +const firstChar = text[0]; + +console,log(firstChar); From 484ff8999d087e77a9425b1a24c09d3d77983607 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Sat, 26 Sep 2026 23:10:35 +0200 Subject: [PATCH 03/34] edit prep files --- Sprint-2/1-key-exercises/2-initials.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 1cb11e620..c408da9c7 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -11,4 +11,5 @@ const initials = ``; const firstChar = text[0]; -console,log(firstChar); +console,log(initials); + From 62ce6cc39ebf63c398f7475a50cb1cd54dd8e360 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Sat, 26 Sep 2026 23:14:55 +0200 Subject: [PATCH 04/34] updated template literal --- Sprint-2/1-key-exercises/2-initials.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index c408da9c7..d1e4ab094 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -11,5 +11,6 @@ const initials = ``; const firstChar = text[0]; -console,log(initials); +console,log(`${initials}`); + From c1f4e1e93eb851255ee3be068d79dc1270a64624 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Mon, 28 Sep 2026 21:06:51 +0200 Subject: [PATCH 05/34] added template literal for intitials --- Sprint-2/1-key-exercises/2-initials.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index d1e4ab094..4b3acce4b 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -5,12 +5,9 @@ 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 = ``; +const initials = `${firstName[0]}${middleName[0]}${lastName[0]}`; // https://www.google.com/search?q=get+first+character+of+string+mdn -const firstChar = text[0]; - -console,log(`${initials}`); From e736c2d346c1b101c10de3ab3bd64fc217c46210 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 21:30:22 +0200 Subject: [PATCH 06/34] added console.log to 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 4b3acce4b..51daa007d 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -7,6 +7,8 @@ const lastName = "Johnson"; const initials = `${firstName[0]}${middleName[0]}${lastName[0]}`; +console.log("initials"); + // https://www.google.com/search?q=get+first+character+of+string+mdn From 1ce816b68e65c0dad72979ac4481b74d55c98041 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 21:32:59 +0200 Subject: [PATCH 07/34] removed inverted commas from console.log --- Sprint-2/1-key-exercises/2-initials.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 51daa007d..c8effcf6f 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -7,7 +7,7 @@ const lastName = "Johnson"; const initials = `${firstName[0]}${middleName[0]}${lastName[0]}`; -console.log("initials"); +console.log(initials); // https://www.google.com/search?q=get+first+character+of+string+mdn From 1d5ad5666bb7a9b49041fc3a0c05466c3b131c39 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 22:14:22 +0200 Subject: [PATCH 08/34] added slice to dir variable --- Sprint-2/1-key-exercises/3-paths.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..7b20bbe0c 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,8 @@ 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 ext = ; +const dir = filepath.slice(0,lastSlashIndex); +console.log(dir); +const ext = slice(); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From 775c3f56189d3fbdbffac0c1ae95f3ad41f5c2f3 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 22:16:15 +0200 Subject: [PATCH 09/34] corrected grammar in const dir --- Sprint-2/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 7b20bbe0c..923fa9571 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,7 @@ 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 = filepath.slice(0,lastSlashIndex); +const dir = filePath.slice(0,lastSlashIndex); console.log(dir); const ext = slice(); From 868d35270487162e35002a4d396f8d2f90c86538 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 22:24:35 +0200 Subject: [PATCH 10/34] Added LastDotIndex variable --- Sprint-2/1-key-exercises/3-paths.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 923fa9571..ca26de567 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -19,6 +19,7 @@ console.log(`The base part of ${filePath} is ${base}`); const dir = filePath.slice(0,lastSlashIndex); console.log(dir); -const ext = slice(); +const LastDotIndex = base.lastIndexOf("."); +const ext = base.slice("/"); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From e6e161082367aa49825ade25754bc2da186a9253 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 22:27:34 +0200 Subject: [PATCH 11/34] added ext print function --- Sprint-2/1-key-exercises/3-paths.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ca26de567..38dc8a418 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -19,7 +19,8 @@ console.log(`The base part of ${filePath} is ${base}`); const dir = filePath.slice(0,lastSlashIndex); console.log(dir); -const LastDotIndex = base.lastIndexOf("."); -const ext = base.slice("/"); +const lastDotIndex = base.lastIndexOf("."); +const ext = base.slice("lastDotIndex + 1"); +console.log(ext); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +// https://www.google.com/search?q=slice+mdn \ No newline at end of file From ad31727f560ee9fabaf6c50d4a9a36049c4b8035 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 22:35:48 +0200 Subject: [PATCH 12/34] removed quotes in sliced ext variable --- Sprint-2/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 38dc8a418..5f4d04e89 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -20,7 +20,7 @@ console.log(`The base part of ${filePath} is ${base}`); const dir = filePath.slice(0,lastSlashIndex); console.log(dir); const lastDotIndex = base.lastIndexOf("."); -const ext = base.slice("lastDotIndex + 1"); +const ext = base.slice(lastDotIndex + 1); console.log(ext); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From edb729d5b586066dbfccb9f2d144872ab5d85bd1 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 22:39:01 +0200 Subject: [PATCH 13/34] added print function to 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..33e1f4a8c 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 + console.log(num); + \ No newline at end of file From d6ea3d3b04e70010dcdd346db2e36763d5595942 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:27:28 +0200 Subject: [PATCH 14/34] unpacked expressions --- 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 33e1f4a8c..145b5237e 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -7,5 +7,8 @@ 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 - console.log(num); - \ No newline at end of file + +console.log(num); + +// num represents any randomly generated number between 1 and 100. +// Math.random pulls a random decimal, Math.floor rounds down to nearest whole number, (maximum - minimum + 1) sets the range, adding the minimum of 1 at the end allows for the possibility of a random number being 100 instead of 99. \ No newline at end of file From 6e1a31f532e564903032e268c1487b5414661c4d Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:29:48 +0200 Subject: [PATCH 15/34] added let --- 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..6e3d23282 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; -age = age + 1; +let age = age + 1; From dd2cdbcac18717987c6af58ad0ec34dc270c871e Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:30:49 +0200 Subject: [PATCH 16/34] Added print function --- 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 6e3d23282..90f0b79e8 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -2,3 +2,5 @@ const age = 33; let age = age + 1; + +console.log(age); From d77e8e23371b2fe069ca716159d27eb6879e0cce Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:33:26 +0200 Subject: [PATCH 17/34] removed second declaration of age variable --- Sprint-2/2-mandatory-errors/1.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 90f0b79e8..fb40d0b61 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,6 +1,7 @@ // trying to create an age variable and then reassign the value by 1 -const age = 33; -let age = age + 1; +let age = 33; +age = age + 1; console.log(age); + From 0bec30ff6b7936ac18250934afaea8e39ddbbd7a Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:35:35 +0200 Subject: [PATCH 18/34] removed back ticks and replaced with quotes --- Sprint-2/2-mandatory-errors/2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..055828d59 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -1,5 +1,5 @@ // 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}`); +console.log("I was born in ${cityOfBirth}"); const cityOfBirth = "Bolton"; From ecbb8e19fb16e7a3bd9c02cb278fb5dd3e92b654 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:40:52 +0200 Subject: [PATCH 19/34] put variable above print function --- 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 055828d59..1f3f6dd33 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -1,5 +1,6 @@ // 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}"); + From 216b40b1a6549b6b27e35194878688d83af3a17b Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:42:55 +0200 Subject: [PATCH 20/34] put variable first --- Sprint-2/2-mandatory-errors/2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 1f3f6dd33..c441b2e77 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -2,5 +2,5 @@ // what's the error ? const cityOfBirth = "Bolton"; -console.log("I was born in ${cityOfBirth}"); +console.log(`I was born in ${cityOfBirth}`); From 8cb21df52a267a4db5ef65782358244edc2a3c98 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:46:54 +0200 Subject: [PATCH 21/34] added print function for last4Digits --- Sprint-2/2-mandatory-errors/3.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..7f158ffd5 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -7,3 +7,6 @@ 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 + +// Card Number is declared as a number and not a string, so slice won't work. +console.log(last4Digits); From 624fc648f8dd0903cbaa8313f8f1a31098f3ec10 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:52:14 +0200 Subject: [PATCH 22/34] added template literal --- Sprint-2/2-mandatory-errors/3.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 7f158ffd5..57d0be0df 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 = `{cardNumber}`.slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working @@ -10,3 +10,4 @@ const last4Digits = cardNumber.slice(-4); // Card Number is declared as a number and not a string, so slice won't work. console.log(last4Digits); +// Yes this is what I predicted. The error is - cardNumber.slice is not a function. From a5119eb21b8d7c47b093946389a19ee78351e495 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:53:42 +0200 Subject: [PATCH 23/34] added $ to template literal --- 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 57d0be0df..882e4f8fa 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 = `${cardNumber}`.slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working From 58e31bfda19b8bc9c2f1502bca05b7a828e679e1 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:55:57 +0200 Subject: [PATCH 24/34] added explanation for answer --- Sprint-2/2-mandatory-errors/3.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 882e4f8fa..aeedfcf79 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -11,3 +11,4 @@ const last4Digits = `${cardNumber}`.slice(-4); // Card Number is declared as a number and not a string, so slice won't work. console.log(last4Digits); // Yes this is what I predicted. The error is - cardNumber.slice is not a function. +// I used a template literal because it will automatically convert the number to a string before slicing. From 5f2d6e022b0dcfb587a4f4d1b9e88a7cf6631b4c Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Thu, 1 Oct 2026 23:57:01 +0200 Subject: [PATCH 25/34] Added print function for 12hour clocl --- 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..5f0eb41c7 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); From 43087db63c7a178b8ff45c87efda168982b5a865 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 00:03:31 +0200 Subject: [PATCH 26/34] changed numbers to words in variables --- Sprint-2/2-mandatory-errors/4.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f0eb41c7..402ce71ae 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,4 +1,5 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const twelveHourClockTime = "8:53pm"; +const twentyFourhourClockTime = "20:53"; + +console.log(twelveHourClockTime); -console.log(12HourClockTime); From a5213f20c25677008d6c0a39a8b7714f42a44301 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 00:10:35 +0200 Subject: [PATCH 27/34] added print for 24 hour clock time --- Sprint-2/2-mandatory-errors/4.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 402ce71ae..c7690b0fa 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -2,4 +2,5 @@ const twelveHourClockTime = "8:53pm"; const twentyFourhourClockTime = "20:53"; console.log(twelveHourClockTime); +console.log(twentyFourhourClockTime); From 3145e30d32b051de674ffb022dcc11e4e7a08d1a Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 21:14:06 +0200 Subject: [PATCH 28/34] answered a) --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 5 +++++ 1 file changed, 5 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..b0cf74509 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -12,6 +12,11 @@ console.log(`The percentage change is ${percentageChange}`); // Read the code and then answer the questions below // a) How many function calls are there in this file? Write down all the lines where a function call is made +// There are 3 function calls. +// carPrice = Number(carPrice.replaceAll(",", "")); +// priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); +// console.log(`The percentage change is ${percentageChange}`); + // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? From 72dfb0ca4e7ea8133f1e297ea1da4f9d00f8f596 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 21:17:40 +0200 Subject: [PATCH 29/34] answered b) --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index b0cf74509..fa77bddb9 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; @@ -19,7 +19,7 @@ console.log(`The percentage change is ${percentageChange}`); // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? - +// The error is coming from line 5. There is a separator missing from the function call. Insert a comma to fix the problem. // c) Identify all the lines that are variable reassignment statements // d) Identify all the lines that are variable declarations From 6edc642e5242befef00f0d29f4f55f9e5a9197d1 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 21:20:43 +0200 Subject: [PATCH 30/34] corrected answeer a --- 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 fa77bddb9..b47a5410c 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -12,7 +12,7 @@ console.log(`The percentage change is ${percentageChange}`); // Read the code and then answer the questions below // a) How many function calls are there in this file? Write down all the lines where a function call is made -// There are 3 function calls. +// There are 5 function calls. // carPrice = Number(carPrice.replaceAll(",", "")); // priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); // console.log(`The percentage change is ${percentageChange}`); @@ -20,6 +20,7 @@ console.log(`The percentage change is ${percentageChange}`); // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? // The error is coming from line 5. There is a separator missing from the function call. Insert a comma to fix the problem. + // c) Identify all the lines that are variable reassignment statements // d) Identify all the lines that are variable declarations From efd42ad1e33d44a2fda060a0201b6a448b6aee55 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 21:33:54 +0200 Subject: [PATCH 31/34] answered e) and added line numbers to c) and d) --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index b47a5410c..e45cf154d 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -22,7 +22,13 @@ console.log(`The percentage change is ${percentageChange}`); // The error is coming from line 5. There is a separator missing from the function call. Insert a comma to fix the problem. // c) Identify all the lines that are variable reassignment statements +// carPrice = Number(carPrice.replaceAll(",", "")); +// priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); // d) Identify all the lines that are variable declarations +// let carPrice = "10,000"; +// let priceAfterOneYear = "8,543"; +// const priceDifference = carPrice - priceAfterOneYear; +// const percentageChange = (priceDifference / carPrice) * 100; // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? From a2df7b1062dad8bef366b30c6f843dde19d4d21d Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 21:34:32 +0200 Subject: [PATCH 32/34] updated c, d and e --- .../3-mandatory-interpret/1-percentage-change.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index e45cf154d..627ebb163 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -22,13 +22,17 @@ console.log(`The percentage change is ${percentageChange}`); // The error is coming from line 5. There is a separator missing from the function call. Insert a comma to fix the problem. // c) Identify all the lines that are variable reassignment statements -// carPrice = Number(carPrice.replaceAll(",", "")); -// priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); +// Line 4 carPrice = Number(carPrice.replaceAll(",", "")); +// Line 5 priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); // d) Identify all the lines that are variable declarations -// let carPrice = "10,000"; -// let priceAfterOneYear = "8,543"; -// const priceDifference = carPrice - priceAfterOneYear; -// const percentageChange = (priceDifference / carPrice) * 100; +// 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; // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +// carPrice.replaceAll(",", "") removes every comma from the string, turning "10,000" into "10000". +// Number(...) then converts that string into the number 10000. +// The purpose is to turn a formatted price string into a real number so it can be used in calculations. +// Without the commas removed, Number("10,000") would return NaN. \ No newline at end of file From 4e87ea568d80e84d3b02523fe50d38e973a19142 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Fri, 2 Oct 2026 22:39:29 +0200 Subject: [PATCH 33/34] added d and e answers --- 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..985e2d411 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -12,14 +12,25 @@ console.log(result); // For the piece of code above, read the code and then answer the following questions // a) How many variable declarations are there in this program? +// There are 6 variable declarations. // b) How many function calls are there? +// There is 1 function call. // c) Using documentation, explain what the expression movieLength % 60 represents // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators +// % is the remainder operator. It returns what is left over after dividing one number by another. +// movieLength % 60 gives the seconds left over once all the full minutes are taken out of the movie length. +// 8784 % 60 = 24, because 8784 seconds is 146 full minutes with 24 seconds left over. + // d) Interpret line 4, what does the expression assigned to totalMinutes mean? +// It subtracts the leftover seconds from the movie length, leaving a number that divides evenly by 60 +// (8784 - 24 = 8760), then divides by 60 to get the number of whole minutes (8760 / 60 = 146). +// So totalMinutes is the total number of complete minutes in the movie. // e) What do you think the variable result represents? Can you think of a better name for this variable? +// The variable result represents the total length of the movie in hours, minutes and seconds. A better name would be movieLengthHHMMSS. // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer + From ddaeb224156deb532534708d6b00e2bb25131411 Mon Sep 17 00:00:00 2001 From: Raees Stevens Date: Sat, 3 Oct 2026 17:23:46 +0200 Subject: [PATCH 34/34] answered all questions --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 25 +++++++++++++++++++ 1 file changed, 25 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..3f0e152b3 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -25,3 +25,28 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" + +// 3. const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1): +// Takes the characters from index 0 up to (but not including) the last character. +// penceString.length is 4, so this is substring(0,3), resulting in "399". +// The purpose is to remove the "p" so only digits remain. + +// 8. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") +// Adds "0"s to the start until the string is at least 3 characters long. +// The purpose is to guarantee at least one digit for pounds and two digits for pence. + +// 9. const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2); +// The purpose is to make the pounds all the digits before the last two, by taking everything except the last two characters: substring(0,1), giving "3" + +// 14. const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); +// substring(1) takes from index 1 to the end, giving "99". +// padEnd(2, "0") adds "0"s to the end until it is two characters long, so "99" stays "99". +// The purpose is too ensure the pence are always the last two digits. +// The padEnd does not change anything here since line 8 already guarantees at leas 3 characters, so the last two characters always exist. + +// 18. console.log(`£${pounds}.${pence}`); +// Call function using a template literal to combine "£", the pounds, a ".", and the pence, then prints "£3.99". + + + +