From 2300ec7505b2d9c3c2f0bd69aecfd4ccf3c358a2 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sun, 20 Sep 2026 19:53:16 +0100 Subject: [PATCH 01/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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/34] 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. From 2d3769c4cad85007df07717b00e5b9a8e73d6c7e Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Thu, 24 Sep 2026 22:22:01 +0100 Subject: [PATCH 25/34] Fix TypeError by changing const to let for age Corrected the reassignment of a constant variable in the code. --- 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 c3714c46a..4cb5348f5 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,5 +1,5 @@ // trying to create an age variable and then reassign the value by 1 - +// the vatriable age was declared as a const variable and trying to assigne another value caused a TypeError: Assignment to constant variable. let age = 33; age = age + 1; console.log(age) From 428cd8a5fef8225ccf603bd28e6c9ba3d1eb2de3 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Thu, 24 Sep 2026 22:29:38 +0100 Subject: [PATCH 26/34] Clarify error message for .slice() method usage Added explanation about the error caused by using .slice() on a number. --- Sprint-2/2-mandatory-errors/3.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index eb148b7c9..76ceec974 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -7,3 +7,5 @@ console.log(last4Digits); // 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 + +// The .slice() method works on strings, but numbers don't have a .slice() method and it will cause this error : cardNumber.slice is not a function From 918f3c4378ac1bd38698a0f43dff7427c51fc6c6 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Thu, 24 Sep 2026 22:32:48 +0100 Subject: [PATCH 27/34] Add comment about variable naming rules Added a comment explaining that variable names cannot start with a number, which causes a SyntaxError. --- 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 afbfa6593..be75cf641 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,3 @@ const twelveHourClockTime = "8:53pm"; const twentyFourHourClockTime= "20:53"; +// a variable name cannot start with a number and it will cause a SyntaxError From 7e294c80571faa398cfa41df9e2d9b9fcdf3ce38 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 16:05:35 +0100 Subject: [PATCH 28/34] Fix ReferenceError by declaring cityOfBirth first Fixed the order of variable declaration and usage for cityOfBirth. --- 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 d57ab0492..bd986fea5 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?in the original code,line 4 creates it and line 3 uses the createOfBirth,Then I changed console.log to the next line because we need to declare the variable before using it. //ReferenceError: Cannot access 'cityOfBirth' before initialization const cityOfBirth = "Bolton"; From 22a0e1d2e7dad8382845c54553eb2625b836fa1e Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 16:11:32 +0100 Subject: [PATCH 29/34] Update comment on type error for .slice() method Clarified the error message explanation regarding the use of .slice() on numbers. --- 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 76ceec974..f8007c9d3 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -8,4 +8,4 @@ console.log(last4Digits); // 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 -// The .slice() method works on strings, but numbers don't have a .slice() method and it will cause this error : cardNumber.slice is not a function +// The .slice() method works on strings, but numbers don't have a .slice() method and it will cause this error : cardNumber.slice is not a function and I think it's kind of type error. From e57f96850dbf51de4d796f243a77d368ddfc9f1c Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 16:19:22 +0100 Subject: [PATCH 30/34] Improve comments for random number explanation Clarify comments explaining the random number generation logic. --- 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 ae3937c49..c7cb0df90 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -6,6 +6,6 @@ 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? + 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 +//after that we multiple these two given values between 0-100 and the floor methode rounds down the given value and then adding 1(minimum) to the result. // 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 cd6f8ffd755e0bcf38bb07bc35592d7e1e63d70b Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 16:26:29 +0100 Subject: [PATCH 31/34] Clarify comments on function calls and errors Updated comments for clarity on function calls and error explanation. --- .../3-mandatory-interpret/1-percentage-change.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index db4b67434..a3c4bc505 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -14,18 +14,15 @@ console.log(`The percentage change is ${percentageChange}`); // 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 +//Line 4 and 5 //Number(...) -//Line 4 -//priceAfterOneYear.replaceAll(",", "") -//Line 5 -//Number(...) -//Line 5 -//priceAfterOneYear.replaceAll(",", "") -//Line 10 ,console.log +//Line 4 and 5 +//console.log() +//Line 10 , // 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. +//error:line 5,SyntaxError: missing ) after argument list,there is a missing comma between the two arguments "," and " " + // c) Identify all the lines that are variable reassignment statements //carPrice = Number(carPrice.replaceAll(",", "")); //priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); From 74dd263c53933fe59af4fea268bfb94cb93f448c Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 16:32:17 +0100 Subject: [PATCH 32/34] Clarify comments on variable declarations and function calls Updated comments to clarify variable declarations and function calls. --- Sprint-2/3-mandatory-interpret/2-time-format.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 4eb7bfc13..1fe8e7a57 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -11,9 +11,10 @@ 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?6 +// a) How many variable declarations are there in this program? six variable,1-movieLenghth , 2- remainingSeconds +//3-totalMinutes , 4- totalHours , 5- result . -// b) How many function calls are there?1 +// b) How many function calls are there? one function ,line 10 : console.log() // c) Using documentation, explain what the expression movieLength % 60 represents? //8784 % 60=24 From fbb60c9b36ea7f8a2ad146a4ed418ae1edf20f59 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 16:43:15 +0100 Subject: [PATCH 33/34] Refine comments in 3-to-pounds.js Updated comments for clarity and consistency. --- 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 161045952..f44eacd93 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -25,12 +25,16 @@ console.log(`£${pounds}.${pence}`); //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");This uses padStart() to make sure the string has at least 3 characters. +//padStart() adds characters to the begining of a string to make it 3 character long. + //const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); +// we remove the last two characters and stores the remaining part of the string as pounds. //This line extracts the pounds part. //line14:penceString = "399p" //paddedPenceNumberString is "399". -//The substring() takes the last two characters, so:"399" → "99" +//The substring() takes the last two characters as pence., 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 +//padEnd(2, "0") adds "0" to the end of the string until it reaches a length of 2. +//finally line 18 combines pound and pence which is £3.99 From c403492febf2026ce1fdf67a34e347906010a9a2 Mon Sep 17 00:00:00 2001 From: anitahy73 Date: Sat, 26 Sep 2026 21:17:23 +0100 Subject: [PATCH 34/34] Used Prettier to make the code prettier --- Sprint-2/1-key-exercises/1-count.js | 2 -- Sprint-2/1-key-exercises/2-initials.js | 1 - Sprint-2/1-key-exercises/3-paths.js | 1 - Sprint-2/1-key-exercises/4-random.js | 2 +- Sprint-2/2-mandatory-errors/1.js | 2 +- Sprint-2/2-mandatory-errors/4.js | 2 +- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 5 ++--- Sprint-2/3-mandatory-interpret/2-time-format.js | 7 ++----- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 5 ++--- 9 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 66ee61450..e55eaf0f6 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,5 +4,3 @@ 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 = we calculate the value of sum operator and put it in left variable. - - diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index aa9d69f65..af023e837 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -11,5 +11,4 @@ let initials = console.log(initials); - // https://www.google.com/search?q=get+first+character+of+string+mdn diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ef5afac10..434bd6e8e 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -21,5 +21,4 @@ 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}`); - // https://www.google.com/search?q=slice+mdn diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index c7cb0df90..d0efc2b3d 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -5,7 +5,7 @@ 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? + 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 +//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 and then adding 1(minimum) to the result. // 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 diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 4cb5348f5..64745bf9d 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -2,4 +2,4 @@ // the vatriable age was declared as a const variable and trying to assigne another value caused a TypeError: Assignment to constant variable. let age = 33; age = age + 1; -console.log(age) +console.log(age); diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index be75cf641..65111a62c 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,3 +1,3 @@ const twelveHourClockTime = "8:53pm"; -const twentyFourHourClockTime= "20:53"; +const twentyFourHourClockTime = "20:53"; // a variable name cannot start with a number and it will cause a SyntaxError diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index a3c4bc505..2cd1005c3 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; @@ -17,7 +17,7 @@ console.log(`The percentage change is ${percentageChange}`); //Line 4 and 5 //Number(...) //Line 4 and 5 -//console.log() +//console.log() //Line 10 , // 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? @@ -27,7 +27,6 @@ console.log(`The percentage change is ${percentageChange}`); //carPrice = Number(carPrice.replaceAll(",", "")); //priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); - // d) Identify all the lines that are variable declarations //let carPrice //let priceAfterOneYear diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 1fe8e7a57..4c22c5f81 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -25,7 +25,7 @@ console.log(result); // 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 +//we have 8784 seconds so //8784 - 24 = 8760 //8760 / 60 = 146 it is the total minutes @@ -33,7 +33,4 @@ console.log(result); // 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 - - - +//Works properly for non-negative whole-number seconds; decimals/negative values cause formatting problems diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index f44eacd93..2ed986b55 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -2,13 +2,13 @@ const penceString = "399p"; const penceStringWithoutTrailingP = penceString.substring( 0, - penceString.length - 1 + penceString.length - 1, ); const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); const pounds = paddedPenceNumberString.substring( 0, - paddedPenceNumberString.length - 2 + paddedPenceNumberString.length - 2, ); const pence = paddedPenceNumberString @@ -37,4 +37,3 @@ console.log(`£${pounds}.${pence}`); //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. //finally line 18 combines pound and pence which is £3.99 -