From 0f63b879826e892f1f78c09e0cd8a51d47b48b05 Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 21:59:33 +0000 Subject: [PATCH 01/14] I have finished KeyErrors 0 --- Sprint-1/Module-Structuring-and-Testing-Data | 1 + Sprint-2/1-key-errors/0.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 160000 Sprint-1/Module-Structuring-and-Testing-Data diff --git a/Sprint-1/Module-Structuring-and-Testing-Data b/Sprint-1/Module-Structuring-and-Testing-Data new file mode 160000 index 0000000000..3372770a4d --- /dev/null +++ b/Sprint-1/Module-Structuring-and-Testing-Data @@ -0,0 +1 @@ +Subproject commit 3372770a4d6ae71b931968a6d6deb70dda58a065 diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a07..9fb70bbcad 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,13 +1,18 @@ // Predict and explain first... -// =============> write your prediction here +// =============> The error will be that the variable str is being redefined within the function. It was already defined when it was passed as an arguement. // call the function capitalise with a string input +capitalise("hello world"); // interpret the error message and figure out why an error is occurring +// Error message: SyntaxError: Identifier 'str' has already been declared. The error is because the variable str has already been declared. function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; - return str; + let newStr = `${str[0].toUpperCase()}${str.slice(1)}`; + return newStr; } -// =============> write your explanation here -// =============> write your new code here +// =============> I've given the variable a new name, newStr, to avoid redclaring the variable. +// =============> function capitalise(str) { +// let newStr = `${str[0].toUpperCase()}${str.slice(1)}`; +// return newStr; +//} From 0f18c37e819b8c6b430264ccab2b6f28a1e740e3 Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:05:38 +0000 Subject: [PATCH 02/14] Editted key errors 0 to match more closely with what was asked --- Sprint-2/1-key-errors/0.js | 4 ++-- Sprint-2/1-key-errors/1.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 9fb70bbcad..3d4a972b53 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -7,8 +7,8 @@ capitalise("hello world"); // Error message: SyntaxError: Identifier 'str' has already been declared. The error is because the variable str has already been declared. function capitalise(str) { - let newStr = `${str[0].toUpperCase()}${str.slice(1)}`; - return newStr; + let str = `${str[0].toUpperCase()}${str.slice(1)}`; + return str; } // =============> I've given the variable a new name, newStr, to avoid redclaring the variable. diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f4..998519eaab 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -1,7 +1,6 @@ // Predict and explain first... - // Why will an error occur when this program runs? -// =============> write your prediction here +// =============> The error will be a syntax error because the variable decimalNumber has already been declared as a parameter. The console log is trying to access decimalNumber which is not within its scope. // Try playing computer with the example to work out what is going on @@ -14,7 +13,13 @@ function convertToPercentage(decimalNumber) { console.log(decimalNumber); -// =============> write your explanation here +// =============> I got a syntax error that the variable is already declared. // Finally, correct the code to fix the problem // =============> write your new code here +// function convertToPercentage(decimalNumber) { +// const percentage = `${decimalNumber * 100}%`; +// return percentage; +// } + +// console.log(convertToPercentage(0.5)); \ No newline at end of file From b2869988cf7c107112b015fe5c1d0377268dbe44 Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:08:41 +0000 Subject: [PATCH 03/14] Finished Key error 2 --- Sprint-2/1-key-errors/2.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cfe..4c4e19e524 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -1,20 +1,19 @@ // Predict and explain first BEFORE you run any code... - // this function should square any number but instead we're going to get an error - -// =============> write your prediction of the error here +// =============> The error will be a syntax error. A number is not a valid variable name - variable names cannot start with a number. function square(3) { return num * num; } -// =============> write the error message here +// =============> write the error message here: SyntaxError: Unexpected number. The error is because the variable name cannot start with a number. -// =============> explain this error message here +// =============> explain this error message here: You cannot begin a variable name with a number // Finally, correct the code to fix the problem -// =============> write your new code here - - +// =============> write your new code here: +// function square(num) { +// return num * num; +// } From c35ac0cc79184d75cf74342ac7006a19b95899db Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:12:46 +0000 Subject: [PATCH 04/14] Finished mandatory debug --- Sprint-2/2-mandatory-debug/0.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b417..d73107f5d4 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,6 +1,6 @@ // Predict and explain first... -// =============> write your prediction here +// =============> write your prediction here: The function does not return any value so instead of 320 being printed, undefined will be printed instead. function multiply(a, b) { console.log(a * b); @@ -8,7 +8,10 @@ function multiply(a, b) { console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); -// =============> write your explanation here +// =============> write your explanation here: It is a logic error as it prints out an unexpected value, undefined. // Finally, correct the code to fix the problem // =============> write your new code here +//function multiply(a, b) { +// return a * b; +//} \ No newline at end of file From f5b1cd8d7cc365abdc124c97f7f34148bf190ad7 Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:14:49 +0000 Subject: [PATCH 05/14] Finished mandatory debug 1 --- Sprint-2/2-mandatory-debug/1.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 37cedfbcfd..51b05128fc 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,5 +1,5 @@ // Predict and explain first... -// =============> write your prediction here +// =============> write your prediction here: The function does not return any value. The a + b should be before the semi-colon and after the return. It will print undefined instead of 42. function sum(a, b) { return; @@ -8,6 +8,9 @@ function sum(a, b) { console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); -// =============> write your explanation here +// =============> write your explanation here: It is a logic error as it prints out an unexpected answer, undefined. // Finally, correct the code to fix the problem // =============> write your new code here +// function sum(a, b) { +// return a + b; +//} \ No newline at end of file From ae15e29cf32e94d46785424b69cd4d4b75c9aedc Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:19:08 +0000 Subject: [PATCH 06/14] Finished mandatory debug 2 --- Sprint-2/2-mandatory-debug/2.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc35..76cbdf2520 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -1,7 +1,7 @@ // Predict and explain first... // Predict the output of the following code: -// =============> Write your prediction here +// =============> Write your prediction here: The function getLastDigit doesn't take any parameters, so it will always return the last digit of the number 103, 3. const num = 103; @@ -14,11 +14,19 @@ console.log(`The last digit of 105 is ${getLastDigit(105)}`); console.log(`The last digit of 806 is ${getLastDigit(806)}`); // Now run the code and compare the output to your prediction -// =============> write the output here +// =============> write the output here: The last digit of 42 is 3. The last digit of 105 is 3. The last digit of 806 is 3 // Explain why the output is the way it is -// =============> write your explanation here +// =============> write your explanation here: The function getLastDigit doesn't take any parameters, so it always returns the last digit of the variable num, which is 103. // Finally, correct the code to fix the problem -// =============> write your new code here +// =============> write your new code here: +// function getLastDigit(num) { +// return num.toString().slice(-1); +// } + +// console.log(`The last digit of 42 is ${getLastDigit(42)}`); +// console.log(`The last digit of 105 is ${getLastDigit(105)}`); +// console.log(`The last digit of 806 is ${getLastDigit(806)}`); // This program should tell the user the last digit of each number. // Explain why getLastDigit is not working properly - correct the problem +// The function getLastDigit is not working properly because it does not take any parameters, so it always returns the last digit of the variable num, which is 103. From 53dfb73ba82eec91352792ecb4f0ae8d2d879067 Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:57:11 +0000 Subject: [PATCH 07/14] Completed mandatory implement 1 --- Sprint-2/3-mandatory-implement/1-bmi.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1b..62febb203a 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -16,4 +16,5 @@ function calculateBMI(weight, height) { // return the BMI of someone based off their weight and height + return (weight/(height**2)).toFixed(1); } \ No newline at end of file From 601f0515495876e71d3555ab511b98d06a4fe84b Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 22:59:27 +0000 Subject: [PATCH 08/14] Completed mandatory-implement 2 --- Sprint-2/3-mandatory-implement/2-cases.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad9..9ecc8e6863 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,7 @@ // You will need to come up with an appropriate name for the function // Use the MDN string documentation to help you find a solution // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase + +function upperSnakeCase(str){ + return str.toUpperCase().split(" ").join("_"); +} From 6cb971f95732a6c67bd36cb14e57a246d138b824 Mon Sep 17 00:00:00 2001 From: Divine Date: Mon, 2 Mar 2026 23:18:51 +0000 Subject: [PATCH 09/14] Finished mandatory interpret 3 --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 6265a1a703..ca6385c1ad 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,14 @@ // You will need to declare a function called toPounds with an appropriately named parameter. // You should call this function a number of times to check it works for different inputs + +function toPounds(penceString){ + const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1); + const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); + const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); + const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); + return `£${pounds}.${pence}`; +} + +console.log(toPounds("100p")); +console.log(toPounds("30000p")); \ No newline at end of file From 4f0ce611050b0c8b2f04630c929922bce96a1071 Mon Sep 17 00:00:00 2001 From: Divine Date: Wed, 4 Mar 2026 17:35:50 +0000 Subject: [PATCH 10/14] Finished mandatory implement time format --- Sprint-2/4-mandatory-interpret/time-format.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 7c98eb0e8c..6ce73465a6 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -17,18 +17,18 @@ function formatTimeDisplay(seconds) { // Questions // a) When formatTimeDisplay is called how many times will pad be called? -// =============> write your answer here +// =============> 3 times // Call formatTimeDisplay with an input of 61, now answer the following: // b) What is the value assigned to num when pad is called for the first time? -// =============> write your answer here +// =============> 0 // c) What is the return value of pad is called for the first time? -// =============> write your answer here +// =============> "00" // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer -// =============> write your answer here +// =============> 1. The last pad call is pad(remainingSeconds), and with 61 seconds input, remainingSeconds = 61 % 60 = 1 // e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer -// =============> write your answer here +// =============> "01". pad(1) calls toString() to get "1", then padStart(2, "0") pads it to "01" From f6eafd0000d1b19d85fe1fd8d9d620809dff0eea Mon Sep 17 00:00:00 2001 From: Divine Date: Wed, 4 Mar 2026 21:16:46 +0000 Subject: [PATCH 11/14] Remedied unexpected file change in sprint 1 --- Sprint-1/Module-Structuring-and-Testing-Data | 1 - 1 file changed, 1 deletion(-) delete mode 160000 Sprint-1/Module-Structuring-and-Testing-Data diff --git a/Sprint-1/Module-Structuring-and-Testing-Data b/Sprint-1/Module-Structuring-and-Testing-Data deleted file mode 160000 index 3372770a4d..0000000000 --- a/Sprint-1/Module-Structuring-and-Testing-Data +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3372770a4d6ae71b931968a6d6deb70dda58a065 From 925895f93a68a3121aea85522d1751150e06b941 Mon Sep 17 00:00:00 2001 From: Divine Date: Wed, 11 Mar 2026 14:30:41 +0000 Subject: [PATCH 12/14] Updated based on comment from volunteer --- Sprint-1/Module-Structuring-and-Testing-Data | 1 + Sprint-2/1-key-errors/0.js | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 160000 Sprint-1/Module-Structuring-and-Testing-Data diff --git a/Sprint-1/Module-Structuring-and-Testing-Data b/Sprint-1/Module-Structuring-and-Testing-Data new file mode 160000 index 0000000000..3372770a4d --- /dev/null +++ b/Sprint-1/Module-Structuring-and-Testing-Data @@ -0,0 +1 @@ +Subproject commit 3372770a4d6ae71b931968a6d6deb70dda58a065 diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 3d4a972b53..0f61b1945d 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -11,8 +11,7 @@ function capitalise(str) { return str; } -// =============> I've given the variable a new name, newStr, to avoid redclaring the variable. -// =============> function capitalise(str) { -// let newStr = `${str[0].toUpperCase()}${str.slice(1)}`; -// return newStr; -//} +// //function capitalise(str) { +// return str[0].toUpperCase() + str.slice(1); +// } +// //} From 8416a21a3b5b0d066cfdceaf6625f4c505c03bdd Mon Sep 17 00:00:00 2001 From: Divine Date: Wed, 11 Mar 2026 14:32:50 +0000 Subject: [PATCH 13/14] Updated bmi task of mandatory debug --- Sprint-2/3-mandatory-implement/1-bmi.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 62febb203a..1325f80a8e 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -16,5 +16,6 @@ function calculateBMI(weight, height) { // return the BMI of someone based off their weight and height - return (weight/(height**2)).toFixed(1); + const bmi = weight / (height * height); + return bmi.toFixed(1); } \ No newline at end of file From 6f10d482a4f5baff1ca82f16bcfd23c0d6385e7e Mon Sep 17 00:00:00 2001 From: Divine Date: Wed, 11 Mar 2026 14:38:36 +0000 Subject: [PATCH 14/14] Resolved merge conflict in time-format.js --- Sprint-2/4-mandatory-interpret/time-format.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 6ce73465a6..72244f53ad 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -11,9 +11,6 @@ function formatTimeDisplay(seconds) { return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`; } -// You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit -// to help you answer these questions - // Questions // a) When formatTimeDisplay is called how many times will pad be called? @@ -24,11 +21,11 @@ function formatTimeDisplay(seconds) { // b) What is the value assigned to num when pad is called for the first time? // =============> 0 -// c) What is the return value of pad is called for the first time? +// c) What is the return value of pad when it is called for the first time? // =============> "00" -// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer +// d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer // =============> 1. The last pad call is pad(remainingSeconds), and with 61 seconds input, remainingSeconds = 61 % 60 = 1 -// e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer -// =============> "01". pad(1) calls toString() to get "1", then padStart(2, "0") pads it to "01" +// e) What is the return value of pad when it is called for the last time in this program? Explain your answer +// =============> "01". pad(1) calls toString() to get "1", then padStart(2, "0") pads it to "01" \ No newline at end of file