From 2300ec7505b2d9c3c2f0bd69aecfd4ccf3c358a2 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 19:53:16 +0100 Subject: [PATCH 01/24] Add comments for count variable and assignment Added comments to explain variable declaration and assignment. --- 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..bf906426d 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -3,4 +3,5 @@ let count = 0; count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 +// Describe whaWt line 3 is doing, in particular focus on what = is doing // Describe what line 3 is doing, in particular focus on what = is doing From 77546b4d268fefbaf4b3569347732da09ed7afe9 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:04:17 +0100 Subject: [PATCH 02/24] Generate initials from name variables Updated the initials variable to dynamically generate initials from first, middle, and last names. --- Sprint-2/1-key-exercises/2-initials.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 964c9563c..aa9d69f65 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -4,7 +4,12 @@ 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. +let initials = + `${firstName.charAt(0)}` + + `${middleName.charAt(0)}` + + `${lastName.charAt(0)}`; + +console.log(initials); -const initials = ``; // https://www.google.com/search?q=get+first+character+of+string+mdn From 1e39939f549cad52e2416f17338573371c71c6ef Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:06:33 +0100 Subject: [PATCH 03/24] Fix comments in 1-count.js for clarity Corrected comments to clarify the purpose of line 3. --- Sprint-2/1-key-exercises/1-count.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index bf906426d..66ee61450 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -3,5 +3,6 @@ let count = 0; count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 -// Describe whaWt line 3 is doing, in particular focus on what = is doing -// Describe what line 3 is doing, in particular focus on what = is doing +// Describe whaWt line 3 is doing, in particular focus on what = we calculate the value of sum operator and put it in left variable. + + From d6958a19c7f40805e3e49418137f8709c257fa0f Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:11:12 +0100 Subject: [PATCH 04/24] Extract directory and extension from filePath Added variables to extract directory and extension from filePath. --- Sprint-2/1-key-exercises/3-paths.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..ef5afac10 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -16,8 +16,10 @@ 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); +console.log(`The direction of the file is ${dir}`); +const ext = filePath.slice(filePath.lastIndexOf(".") + 1); +console.log(`The extenction of the file is ${ext}`); -const dir = ; -const ext = ; -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +// https://www.google.com/search?q=slice+mdn From 6c5f201e85d1743203e08745a16b08b84e371a95 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:15:50 +0100 Subject: [PATCH 05/24] Enhance comments for random number explanation Updated comments to clarify the purpose of the random number generation and the evaluation order of expressions. --- Sprint-2/1-key-exercises/4-random.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..86bec3540 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -3,7 +3,9 @@ const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; -// In this exercise, you will need to work out what num represents? +// In this exercise, you will need to work out what num represents?It gives us a random number between 1-100 // Try breaking down the expression and using documentation to explain what it means + //Math.random gives us a random number between 0-1 and the next parantecec returns 100 +//after that we multiple these two given values between 0-100 and the floor methode rounds down the given value // 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 From 4b1bd0d5064706badccd05bbbdeaa53dad7abeee Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:18:59 +0100 Subject: [PATCH 06/24] Comment out instructions in 0.js --- Sprint-2/2-mandatory-errors/0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index cf6c5039f..1a799bb21 100644 --- a/Sprint-2/2-mandatory-errors/0.js +++ b/Sprint-2/2-mandatory-errors/0.js @@ -1,2 +1,2 @@ -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? we can put back slash to change it into comments. From 424ec1cf85f7c44fb93df1ceb33595ebd27d47d7 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:26:08 +0100 Subject: [PATCH 07/24] Change age variable to let and reassign value Changed 'const' to 'let' for age variable and reassigned it to 1. --- Sprint-2/2-mandatory-errors/1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..d919e07d8 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 = 33; +age = 1; From 18a1da4b14fdaed094778323ad8dc7c6ad1639a5 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:27:37 +0100 Subject: [PATCH 08/24] Correct cityOfBirth declaration for logging Fix variable declaration order to enable correct logging. --- Sprint-2/2-mandatory-errors/2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..7c9153857 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 ? +// what's the error -console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +console.log(`I was born in ${cityOfBirth}`); From 418784e95765066d7e96b768637f788182ad3db9 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:34:12 +0100 Subject: [PATCH 09/24] Fix last4Digits assignment to handle cardNumber correctly Updated last4Digits assignment to convert cardNumber to a string before slicing. --- Sprint-2/2-mandatory-errors/3.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..83d549787 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,9 +1,9 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); - +const last4Digits = string(cardNumber).slice(-4); +console.log(last4Digits); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working -// Before running the code, make and explain a prediction about why the code won't work +// Before running the code, make and explain a prediction about why the code won't work?this function works on string NOT numbers // 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 From 7753eb93f56561b46dc4fe569d527ce451a53c18 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 20:41:56 +0100 Subject: [PATCH 10/24] Fix variable naming for clock time constants --- Sprint-2/2-mandatory-errors/4.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..afbfa6593 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,2 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const twelveHourClockTime = "8:53pm"; +const twentyFourHourClockTime= "20:53"; From b3a99c02d5fcf0a988376bf480dddd012a479dc7 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 21:12:16 +0100 Subject: [PATCH 11/24] Fix missing comma in replaceAll function call --- .../1-percentage-change.js | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index e24ecb8e1..8dbe29c84 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; @@ -11,12 +11,32 @@ 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 +// a) How many function calls are there in this file? Write down all the lines where a function call is made? +//There are 5 function calls: +//replaceAll +//Line 4 +//Number(...) +//Line 4 +//priceAfterOneYear.replaceAll(",", "") +//Line 5 +//Number(...) +//Line 5 +//console.log // 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? - +//missing a comma between the two arguments. // 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 +//let priceAfterOneYear +//const priceDifference +//const percentageChange // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +//it removes all commas from the string +//converts the string "10000" into the number 10000 +//The purpose is to turn the price from a formatted string into a number From ab458e3d4157dd4666673d969b5c7b2aef178a54 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 21:25:27 +0100 Subject: [PATCH 12/24] Add answers to code interpretation questions Updated comments to provide answers to questions about the code. --- Sprint-2/3-mandatory-interpret/2-time-format.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 47d239558..3f58b3254 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -11,15 +11,21 @@ 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? +// a) How many variable declarations are there in this program?6 -// b) How many function calls are there? +// b) How many function calls are there?1 // c) Using documentation, explain what the expression movieLength % 60 represents +//The % operator is called the remainder operator. +//It gives you the remainder left over after division. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators -// d) Interpret line 4, what does the expression assigned to totalMinutes mean? +// d) Interpret line 4, what does the expression assigned to totalMinutes mean?This removes the seconds that don't make up a complete minute. -// e) What do you think the variable result represents? Can you think of a better name for this variable? +// e) What do you think the variable result represents? Can you think of a better name for this variable?creates a formatted representation of the movie's length in hours, minutes, and seconds. // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer + //Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems + + + From 78097f10343b5b88fb0830c58bfb1f6a7ad25c05 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 21:50:58 +0100 Subject: [PATCH 13/24] Enhance code readability with detailed comments Added comments to explain the purpose of each line in the program. --- 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..e04643e0e 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -22,6 +22,12 @@ console.log(`£${pounds}.${pence}`); // You need to do a step-by-step breakdown of each line in this program // Try and describe the purpose / rationale behind each step +//this function penceString.length-1 removes the last p from string so it values 3 because it contains 4 characters minues 1. +//penceString.substring(0, 3) and it takes the characters from position 0 up to, but not including, position 3. +//const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); +//const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");This uses padStart() to make sure the string has at least 3 characters. +//const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); +//This line extracts the pounds part. // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" From e953ec66378f3339b514c9cee6a571179ec823ee Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 22:06:09 +0100 Subject: [PATCH 14/24] Update explanations for alert and prompt functions Clarified effects and return values of alert and prompt functions. --- Sprint-2/4-stretch-explore/chrome.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/4-stretch-explore/chrome.md b/Sprint-2/4-stretch-explore/chrome.md index 962580b82..37b9a35f7 100644 --- a/Sprint-2/4-stretch-explore/chrome.md +++ b/Sprint-2/4-stretch-explore/chrome.md @@ -8,8 +8,9 @@ Let's try an example. In the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`; What effect does calling the `alert` function have? +alert() is a function that displays a message to the user.its return value is undefined. Now try invoking the function `prompt` with a string input of `"What is your name?"` - store the return value of your call to `prompt` in an variable called `myName`. -What effect does calling the `prompt` function have? -What is the return value of `prompt`? +What effect does calling the `prompt` function have?It provides a text box where the user can enter their name, along with buttons such as OK and Cancel. +What is the return value of `prompt`? prompt() returns a value. From 87532a75a52415876ea021a2905627fe59312217 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Mon, 21 Sep 2026 22:21:58 +0100 Subject: [PATCH 15/24] Fix type conversion for last 4 digits extraction Corrected the type conversion from 'string' to 'String' for proper functionality. --- 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 83d549787..eb148b7c9 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 = string(cardNumber).slice(-4); +const last4Digits = String(cardNumber).slice(-4); console.log(last4Digits); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working From 87d18e1fce62540ed12d12a1404fd91939b13d63 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Mon, 21 Sep 2026 22:30:24 +0100 Subject: [PATCH 16/24] Fix age reassignment to increment by 1 --- Sprint-2/2-mandatory-errors/1.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index d919e07d8..c3714c46a 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,4 +1,5 @@ // trying to create an age variable and then reassign the value by 1 let age = 33; -age = 1; +age = age + 1; +console.log(age) From 77da0b4015874dbef243eb2eca8654006d67ee0a Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Mon, 21 Sep 2026 22:52:41 +0100 Subject: [PATCH 17/24] Update comment for clarity on ReferenceError Fixed comment to clarify the error message. --- 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 7c9153857..d57ab0492 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 +// what's the error? +//ReferenceError: Cannot access 'cityOfBirth' before initialization const cityOfBirth = "Bolton"; console.log(`I was born in ${cityOfBirth}`); From 8a38be1f5d7eff076481ed56554668ad17d489aa Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Mon, 21 Sep 2026 23:04:28 +0100 Subject: [PATCH 18/24] Clarify comments on random number generation Updated comments to clarify the random number generation process. --- 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 86bec3540..ae3937c49 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -4,7 +4,7 @@ const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // In this exercise, you will need to work out what num represents?It gives us a random number between 1-100 -// Try breaking down the expression and using documentation to explain what it means +// Try breaking down the expression and using documentation to explain what it means? + minimum shifts it between 1-100 so the minimum number is 1 and the biggest one is 100 //Math.random gives us a random number between 0-1 and the next parantecec returns 100 //after that we multiple these two given values between 0-100 and the floor methode rounds down the given value // It will help to think about the order in which expressions are evaluated From 6d264c242d2e22913e63371d4c3bbfb7ff1c63dd Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Mon, 21 Sep 2026 23:07:37 +0100 Subject: [PATCH 19/24] Comment out console.log and add notes for debugging --- 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 8dbe29c84..acdff48be 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -21,7 +21,7 @@ console.log(`The percentage change is ${percentageChange}`); //Line 5 //Number(...) //Line 5 -//console.log +//Line 9 ,console.log // 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? //missing a comma between the two arguments. From 2e91aea7b3d52d59cd1a579204aaab63ba0298e6 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Mon, 21 Sep 2026 23:19:23 +0100 Subject: [PATCH 20/24] Clarify error message and variable reassignment comments Updated comments to clarify error details and variable reassignment. --- 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 acdff48be..c8b9c7cd8 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -24,7 +24,7 @@ console.log(`The percentage change is ${percentageChange}`); //Line 9 ,console.log // 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? -//missing a comma between the two arguments. +//error:line 5,SyntaxError: missing ) after argument list,missing a comma between the two arguments. // c) Identify all the lines that are variable reassignment statements //carPrice = Number(carPrice.replaceAll(",", "")); //priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); From b48ce39f6c29ea9061f0a1184095757879e33393 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Tue, 22 Sep 2026 15:03:06 +0100 Subject: [PATCH 21/24] Refine comments in 2-time-format.js for better understanding Updated comments for clarity and added explanations for variable meanings. --- 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 3f58b3254..4eb7bfc13 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -15,15 +15,22 @@ console.log(result); // b) How many function calls are there?1 -// c) Using documentation, explain what the expression movieLength % 60 represents +// c) Using documentation, explain what the expression movieLength % 60 represents? +//8784 % 60=24 //The % operator is called the remainder operator. //It gives you the remainder left over after division. +//we can calculate the number of the left seconds after converting the movie length into whole minutes, 24 seconds left over after converting the movie's total length into whole minutes. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators // d) Interpret line 4, what does the expression assigned to totalMinutes mean?This removes the seconds that don't make up a complete minute. +//Then it divides that number by 60 to convert the seconds into whole minutes. +//we have 8784 seconds so -// e) What do you think the variable result represents? Can you think of a better name for this variable?creates a formatted representation of the movie's length in hours, minutes, and seconds. +//8784 - 24 = 8760 +//8760 / 60 = 146 it is the total minutes +// e) What do you think the variable result represents? Can you think of a better name for this variable?creates a formatted representation of the movie's length in hours, minutes, and seconds. +//I can name it the movie duration // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer //Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems From f35bfdc3b79289ab889dde5f112719d2f0b0a5cf Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Tue, 22 Sep 2026 15:29:52 +0100 Subject: [PATCH 22/24] Improve comments for pence to pounds conversion Updated comments to clarify the conversion process from pence to pounds. --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index e04643e0e..b54ccbeb8 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -28,6 +28,10 @@ console.log(`£${pounds}.${pence}`); //const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");This uses padStart() to make sure the string has at least 3 characters. //const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); //This line extracts the pounds part. +//line14:penceString = "399p" + +//paddedPenceNumberString is "399". +//The substring() takes the last two characters, so:"399" → "99" +//Then .padEnd(2, "0") checks the string is at least 2 characters long. If it already has 2 characters, like "99", without changing the rest. +//padEnd(2, "0") adds "0" to the end of the string until it reaches a length of 2 and finally line 18 prints the result which is £3.99 -// To begin, we can start with -// 1. const penceString = "399p": initialises a string variable with the value "399p" From 3a5af8c7356977939fae726e283b71bd35fae8b1 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Tue, 22 Sep 2026 21:09:35 +0100 Subject: [PATCH 23/24] Update comments for error identification in percentage change Commented out lines for debugging and error identification. --- 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 c8b9c7cd8..db4b67434 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -21,7 +21,8 @@ console.log(`The percentage change is ${percentageChange}`); //Line 5 //Number(...) //Line 5 -//Line 9 ,console.log +//priceAfterOneYear.replaceAll(",", "") +//Line 10 ,console.log // 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? //error:line 5,SyntaxError: missing ) after argument list,missing a comma between the two arguments. From c2075ba9fc170ff5f9b59ed2a910d97a1159c7d4 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Tue, 22 Sep 2026 21:11:03 +0100 Subject: [PATCH 24/24] Clean up comments in 3-to-pounds.js Removed commented-out code for padding pence number string. --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 1 - 1 file changed, 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 b54ccbeb8..161045952 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -24,7 +24,6 @@ console.log(`£${pounds}.${pence}`); // Try and describe the purpose / rationale behind each step //this function penceString.length-1 removes the last p from string so it values 3 because it contains 4 characters minues 1. //penceString.substring(0, 3) and it takes the characters from position 0 up to, but not including, position 3. -//const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); //const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");This uses padStart() to make sure the string has at least 3 characters. //const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); //This line extracts the pounds part.