From 4c6240085f9e3d7d73593f31f2ef4ff60a798c0d Mon Sep 17 00:00:00 2001 From: Jorvan White Date: Wed, 10 Jun 2026 12:20:39 +0100 Subject: [PATCH 01/15] updated 1-count.js with an explanation of line 3 --- Sprint-1/1-key-exercises/1-count.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6e..b150e6b932 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,7 @@ 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 + +// = is assigning the value of 'count', +// 'let' is a declararation than enables its subject (count) to be changed +// line 3 is taking the current value in line 1 (0) and by using '=' it is reassigning the value of 'count' to equal itself plus 1 \ No newline at end of file From 376a6b01cc4999bf60a0b87527c15cde540554dd Mon Sep 17 00:00:00 2001 From: JorvanW Date: Sat, 27 Jun 2026 11:47:24 +0100 Subject: [PATCH 02/15] added answers to 0.js --- Sprint-2/1-key-errors/0.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a07..4eacc94f29 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,5 +1,6 @@ // Predict and explain first... -// =============> write your prediction here +// =============> The fuction intends to capitalize the first letter of the input string +// from th left starting with the first character (str[0]). // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring @@ -9,5 +10,7 @@ function capitalise(str) { return str; } -// =============> write your explanation here -// =============> write your new code here +// =============> str has already been declared as a parameter function, so it cannot be redeclared within the function body. This will cause a syntax error. To fix this, we should use a different variable name for the new string we are creating. +// =============> function capitalise(str) { +// str = `${str[0].toUpperCase()}${str.slice(1)}`; +// return str; From 2323e101560b0537b907a05193dbee0334bf0e57 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Sat, 27 Jun 2026 12:00:41 +0100 Subject: [PATCH 03/15] Added notes for 1.js --- Sprint-2/1-key-errors/1.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f4..eff952dc5c 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -1,7 +1,8 @@ // Predict and explain first... -// Why will an error occur when this program runs? -// =============> write your prediction here +// Why will an error occur when this program runs? +// =============> decimalNumber is a constant variable, and cannot be changed. +// The code is attempting to change it which will cause an error. // Try playing computer with the example to work out what is going on @@ -14,7 +15,12 @@ function convertToPercentage(decimalNumber) { console.log(decimalNumber); -// =============> write your explanation here +// =============> The code is attempting to get the percentage of decimalNumber // Finally, correct the code to fix the problem -// =============> write your new code here +function convertToPercentage(decimalNumber) { + decimalNumber = 0.5; + const percentage = `${decimalNumber * 100}%`; + return percentage; +} +console.log (convertToPercentage(0.5)); \ No newline at end of file From 87fbee5134b7cedff178c060e00e940c928563f8 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Sat, 27 Jun 2026 12:17:06 +0100 Subject: [PATCH 04/15] added notes for 2.js --- Sprint-2/1-key-errors/2.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cfe..f8b6621567 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -3,18 +3,22 @@ // this function should square any number but instead we're going to get an error -// =============> write your prediction of the error here +// =============> num is not defined which causes an error. function square(3) { return num * num; } -// =============> write the error message here +// =============> 1. "Uncaught SyntaxError: Unexpected number" Means the "3" is not valid there. +// 2. Uncaught SyntaxError: Illegal return statement. Means "num" has no idea of what it should be -// =============> explain this error message here // Finally, correct the code to fix the problem -// =============> write your new code here +// =============> by adding square(num) the function will work when given a number +function square(num) { + return num * num; +} +console.log(square(3)) From 57e3a65741c6be3cc4537ce35d8ede213e9132e4 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Mon, 29 Jun 2026 10:43:21 +0100 Subject: [PATCH 05/15] added notes to 0.js --- Sprint-2/1-key-errors/0.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 4eacc94f29..3a843eda2b 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -11,6 +11,7 @@ function capitalise(str) { } // =============> str has already been declared as a parameter function, so it cannot be redeclared within the function body. This will cause a syntax error. To fix this, we should use a different variable name for the new string we are creating. -// =============> function capitalise(str) { -// str = `${str[0].toUpperCase()}${str.slice(1)}`; -// return str; +// =============> + function capitalise(str) { + str = `${str[0].toUpperCase()}${str.slice(1)}`; + return str; \ No newline at end of file From bf5c3320dad52e8b6d4cb5a2e8ab1fc23d1c27df Mon Sep 17 00:00:00 2001 From: JorvanW Date: Mon, 29 Jun 2026 10:58:56 +0100 Subject: [PATCH 06/15] added answer to 0.js --- Sprint-2/2-mandatory-debug/0.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b417..26b87fd105 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 +// =============> Code is attempting to multiple a & b but there is no return value function multiply(a, b) { console.log(a * b); @@ -8,7 +8,11 @@ function multiply(a, b) { console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); -// =============> write your explanation here +// =============> because there is no return value, the outcome stays as undefined while giving the answer +// to fix this, change "console.log" in the second row to "return" +// // Finally, correct the code to fix the problem -// =============> write your new code here +function multiply(a, b) { + return (a * b); +} From 4ca3f91c41793395c203b9d0bf4e535988d61362 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Mon, 29 Jun 2026 11:19:08 +0100 Subject: [PATCH 07/15] added notes to 1.js --- Sprint-2/2-mandatory-debug/1.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 37cedfbcfd..a4e2e1d976 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,5 +1,6 @@ // Predict and explain first... -// =============> write your prediction here +// =============> the function is attempting to add "a" & "b" together +// but the return is formatted wrong. function sum(a, b) { return; @@ -8,6 +9,12 @@ function sum(a, b) { console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); -// =============> write your explanation here +// =============> because of the way line 6 and 7 is written the answer will be undefined. +//remove the semi colon from line 6 and then add line 7 to it. // Finally, correct the code to fix the problem -// =============> write your new code here + +function sum(a, b) { + return (a + b); +} + +console.log(sum(10, 32)) From 185c7e745d4c586e16ba493666ed32b4698ff21a Mon Sep 17 00:00:00 2001 From: JorvanW Date: Mon, 29 Jun 2026 11:29:41 +0100 Subject: [PATCH 08/15] added answers to 2.js --- Sprint-2/2-mandatory-debug/2.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc35..b145646d95 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -1,7 +1,8 @@ // Predict and explain first... // Predict the output of the following code: -// =============> Write your prediction here +// =============> The function is trying to get the last digit of "num" +// but because on "const", the "num" is always locked to "103" leaving the return always "3" const num = 103; @@ -14,11 +15,22 @@ 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 +// =============> Just as predicted, the function is trying to get the last digit, which is always "3" // Explain why the output is the way it is -// =============> write your explanation here +// =============> because of "const" the num is always locked to "103" // Finally, correct the code to fix the problem -// =============> 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 +// Explain why getLastDigit is not working properly +// It's not working properly because of the "const num = 103" +// to fix, I have removed the line and added "(num)" after "function getLastDigit" +// In order to define what "num" is. From 195189aa7cd5b896c67e360ebd03c4e5114f9f90 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Sat, 4 Jul 2026 15:38:10 +0100 Subject: [PATCH 09/15] completed. 1-bmi --- Sprint-2/3-mandatory-implement/1-bmi.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1b..55f462875e 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -16,4 +16,11 @@ function calculateBMI(weight, height) { // return the BMI of someone based off their weight and height -} \ No newline at end of file +} + +function calculateBMI(weight, height) { + const bmi = weight / (height * height); + return parseFloat(bmi.toFixed(1)); +} + +console.log(calculateBMI(70, 1.73)); \ No newline at end of file From 3f957a175bd3e263e8f6910223550b5ee50b5978 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Sat, 4 Jul 2026 15:45:33 +0100 Subject: [PATCH 10/15] Answered the questions for 2-cases.js --- Sprint-2/3-mandatory-implement/2-cases.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad9..3ae8e664d5 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,11 @@ // 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 Capitalise(inputString) { + return inputString.toUpperCase() + +} + +Console.log(Capitalise("hello there")); \ No newline at end of file From b48031e6e1ec90f1c16f1a91521f3c042323af2d Mon Sep 17 00:00:00 2001 From: JorvanW Date: Wed, 8 Jul 2026 15:10:30 +0100 Subject: [PATCH 11/15] Added answers to the questions in the time-format.js file. --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 20 +++++++++++++++++++ 1 file changed, 20 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..cfd2bf1b46 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,23 @@ // 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 + +const penceString = "399p"; + +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"); + +console.log(`£${pounds}.${pence}`); + From b5eb41eb43383824ef8ddf9e568d758a6c67a4d2 Mon Sep 17 00:00:00 2001 From: JorvanW Date: Wed, 22 Jul 2026 14:55:11 +0100 Subject: [PATCH 12/15] time-format.js was answered in sprint-3 branch, updated to be in the the correct sprint. --- 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 17127bc01e..9053e171ee 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -21,18 +21,18 @@ function formatTimeDisplay(seconds) { // Questions // a) When formatTimeDisplay is called how many times will pad be called? -// =============> write your answer here +// =============> Pad will be called 3 times, once for totalHours, once for remainingMinutes, and once for remainingSeconds. // 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 +// =============> The value will be 0 // c) What is the return value of pad is called for the first time? -// =============> write your answer here +// =============> The return value will be "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 +// =============> The value assigned to num when pad is called for the last time in this program will be 1.Because it is the value of the remainingSeconds variable, which is calculated as 61 % 60 = 1. // e) What is the return value of pad when it is called for the last time in this program? Explain your answer -// =============> write your answer here +// =============> The output is "01" because the pad function adds a leading zero to the number 1, resulting in a two-character string "01". \ No newline at end of file From f357de1d929b608a589cd33d3e9b8e02bf69ba1d Mon Sep 17 00:00:00 2001 From: Jorvan White Date: Wed, 29 Jul 2026 17:10:12 +0100 Subject: [PATCH 13/15] Delete Sprint-1/1-key-exercises/1-count.js --- Sprint-1/1-key-exercises/1-count.js | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 Sprint-1/1-key-exercises/1-count.js diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js deleted file mode 100644 index b150e6b932..0000000000 --- a/Sprint-1/1-key-exercises/1-count.js +++ /dev/null @@ -1,10 +0,0 @@ -let count = 0; - -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 - -// = is assigning the value of 'count', -// 'let' is a declararation than enables its subject (count) to be changed -// line 3 is taking the current value in line 1 (0) and by using '=' it is reassigning the value of 'count' to equal itself plus 1 \ No newline at end of file From f8f0160392e876a37be894887d93c193029f7a7e Mon Sep 17 00:00:00 2001 From: JorvanW Date: Mon, 3 Aug 2026 17:23:55 +0100 Subject: [PATCH 14/15] removed code from sprint 1 --- Sprint-1/1-key-exercises/1-count.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index b150e6b932..117bcb2b6e 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,7 +4,3 @@ 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 - -// = is assigning the value of 'count', -// 'let' is a declararation than enables its subject (count) to be changed -// line 3 is taking the current value in line 1 (0) and by using '=' it is reassigning the value of 'count' to equal itself plus 1 \ No newline at end of file From e5b65cad1e94cd489470744d5597abeaf325b72b Mon Sep 17 00:00:00 2001 From: JorvanW Date: Mon, 3 Aug 2026 17:31:59 +0100 Subject: [PATCH 15/15] added sprint 1 index file --- Sprint-1/1-key-exercises/1-count.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Sprint-1/1-key-exercises/1-count.js diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js new file mode 100644 index 0000000000..117bcb2b6e --- /dev/null +++ b/Sprint-1/1-key-exercises/1-count.js @@ -0,0 +1,6 @@ +let count = 0; + +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