From b0e374dcd76a8d4a5488f7b8e55b5e6acd1e2588 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Thu, 2 Jul 2026 11:48:34 +0100 Subject: [PATCH 01/11] Added in answer to question. --- Sprint-1/1-key-exercises/1-count.js | 2 ++ Sprint-1/1-key-exercises/2-initials.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6e..e731a272c8 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,5 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing + +// Line 3 is taking the value of count, then adding 1 to that value, then making that new value to be the current count. diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f6175..0238a71c60 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -5,7 +5,7 @@ let 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 = ``; +let initials = firstName[0] + middleName[0] + lastName[0]; // https://www.google.com/search?q=get+first+character+of+string+mdn From 94908cdfd4325d56370fa8e73f22fec5c860c7d8 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Thu, 2 Jul 2026 12:41:05 +0100 Subject: [PATCH 02/11] added code for 3-paths for "dir" and "ext" --- Sprint-1/1-key-exercises/3-paths.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-1/1-key-exercises/3-paths.js b/Sprint-1/1-key-exercises/3-paths.js index ab90ebb28e..0574e974d7 100644 --- a/Sprint-1/1-key-exercises/3-paths.js +++ b/Sprint-1/1-key-exercises/3-paths.js @@ -17,7 +17,7 @@ console.log(`The base part of ${filePath} is ${base}`); // Create a variable to store the dir part of the filePath variable // Create a variable to store the ext part of the variable -const dir = ; -const ext = ; +const dir = filePath.slice (0,lastSlashIndex +1); +const ext = filePath.slice (filePath.lastIndexOf (".")); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From bf72972963a7de97fe1f63eba08568624cc88c02 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Thu, 2 Jul 2026 16:03:53 +0100 Subject: [PATCH 03/11] 4-random added answer with // --- Sprint-1/1-key-exercises/4-random.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-1/1-key-exercises/4-random.js b/Sprint-1/1-key-exercises/4-random.js index 292f83aabb..8226e51fdd 100644 --- a/Sprint-1/1-key-exercises/4-random.js +++ b/Sprint-1/1-key-exercises/4-random.js @@ -2,8 +2,14 @@ const minimum = 1; const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; +console.log (num); // In this exercise, you will need to work out what num represents? // Try breaking down the expression and using documentation to explain what it means // It will help to think about the order in which expressions are evaluated // Try logging the value of num and running the program several times to build an idea of what the program is doing + +// From what I can work out, it is generations a random number between 2 and 100 for the value of num. +// math.floor ensures the number is a whole number without decibils. (maximum - minimu +1) is (100 - 1 + 1)=100. +// Math.random pics a random number from 0 to 1 with two decibils, such as 2.13. +// The Order they follow is: Match.random multiplied by (Maximum - minimum + 1), then add minimum of 1. \ No newline at end of file From b08f2ed8a4f43f0ec1cbbe697fdaf8204697ef74 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Thu, 2 Jul 2026 16:05:17 +0100 Subject: [PATCH 04/11] added // to both lines for mandatory-errors 0.js --- Sprint-1/2-mandatory-errors/0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/0.js b/Sprint-1/2-mandatory-errors/0.js index cf6c5039f7..65ad3030d6 100644 --- a/Sprint-1/2-mandatory-errors/0.js +++ b/Sprint-1/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? \ No newline at end of file From 385e8fd7dd78d0049cf8184ef9d1e9efdb10e005 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 14:26:30 +0100 Subject: [PATCH 05/11] Mandatory errors 1.js changed const to let --- Sprint-1/2-mandatory-errors/1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/1.js b/Sprint-1/2-mandatory-errors/1.js index 7a43cbea76..031839b47d 100644 --- a/Sprint-1/2-mandatory-errors/1.js +++ b/Sprint-1/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; +let age = 33; age = age + 1; From 16f8995dc9cfd031e04a2d0e67f7778c705f357d Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 14:33:39 +0100 Subject: [PATCH 06/11] Mandatory errors, 2.js changed order so 'const' was on line 4 before 'console.log' --- Sprint-1/2-mandatory-errors/2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/2.js b/Sprint-1/2-mandatory-errors/2.js index e09b89831d..c441b2e777 100644 --- a/Sprint-1/2-mandatory-errors/2.js +++ b/Sprint-1/2-mandatory-errors/2.js @@ -1,5 +1,6 @@ // Currently trying to print the string "I was born in Bolton" but it isn't working... // what's the error ? -console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +console.log(`I was born in ${cityOfBirth}`); + From 778229ebf6737b4b171d42a645fd8bab81d65856 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 14:52:58 +0100 Subject: [PATCH 07/11] mandatory errors 3.js added " to cardNumber to make into string, added console.log to make last4Digits visible. --- Sprint-1/2-mandatory-errors/3.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index ec101884db..dbac5885e5 100644 --- a/Sprint-1/2-mandatory-errors/3.js +++ b/Sprint-1/2-mandatory-errors/3.js @@ -1,5 +1,6 @@ -const cardNumber = 4533787178994213; +const cardNumber = "4533787178994213"; const last4Digits = cardNumber.slice(-4); +console.log (last4Digits) // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working @@ -7,3 +8,5 @@ const last4Digits = cardNumber.slice(-4); // Then run the code and see what error it gives. // Consider: Why does it give this error? Is this what I predicted? If not, what's different? // Then try updating the expression last4Digits is assigned to, in order to get the correct value +// I firsth thought the -4 would not work as it starts on 0 +// I then recalled the code wont work as the cardNumber is a number and not a string, it needs to be a string for the .slice to work. From 29cd03fb9859ab07a8a50fd2877507d6e53f9049 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 14:59:28 +0100 Subject: [PATCH 08/11] Manadatory errors 4.js added "_" infront of the numbers to make it valid. --- Sprint-1/2-mandatory-errors/4.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/4.js b/Sprint-1/2-mandatory-errors/4.js index 5f86c730bc..c027f47467 100644 --- a/Sprint-1/2-mandatory-errors/4.js +++ b/Sprint-1/2-mandatory-errors/4.js @@ -1,2 +1,2 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const _12HourClockTime = "8:53pm"; +const _24hourClockTime = "20:53"; From a3a586e0657bd1544af4df20bec77673df6cb092 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 16:20:51 +0100 Subject: [PATCH 09/11] 3 Mandatory interpret - 1 percentage change: Answered the questions from a-e --- Sprint-1/3-mandatory-interpret/1-percentage-change.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-1/3-mandatory-interpret/1-percentage-change.js b/Sprint-1/3-mandatory-interpret/1-percentage-change.js index e24ecb8e18..43f04da1ec 100644 --- a/Sprint-1/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-1/3-mandatory-interpret/1-percentage-change.js @@ -20,3 +20,11 @@ console.log(`The percentage change is ${percentageChange}`); // d) Identify all the lines that are variable declarations // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? + + // a) There are 5 calls made: + // carPrice = Number(carPrice.replaceAll(",", "")); + // priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")) + // b) Error on line 5 for "," it is missing the seperating , between "," and "". + // c) 4 and 5 + // d) 1 and 2, 7 and 8, + // e) It removes the , from the string and replaces it with nothing. Used to help change the string into a number with the "Number" function. From 46f0a14ec8349d2e2d7786e92b71c9b7d7d4cb26 Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 17:27:39 +0100 Subject: [PATCH 10/11] 3-mandatory-interpret 2-time-format added answers to the questions. --- Sprint-1/3-mandatory-interpret/2-time-format.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-1/3-mandatory-interpret/2-time-format.js b/Sprint-1/3-mandatory-interpret/2-time-format.js index 47d2395587..39fb600ce6 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -23,3 +23,11 @@ console.log(result); // e) What do you think the variable result represents? Can you think of a better name for this variable? // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer + + // a) There are 6: movieLength, remainingSeconds, totalMinutes, remainingMinutes, totalHours, result. + // b) There is one: console.log. + // c) It is taking the movieLength and doing a remainder that is showing what is left after the vaule has been divided, in this case wil be 84. + // I found the info here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder + // d) It is removing any extra seconds from the division by 60 so that is is showing as whole numbers without decimals. + // e) Result is showing the movies duration but broken down to hours:minutes:seconds, I think it should be movieDuration to help describe it better. + // f) Yes, it does work to show the lenght even if it is only in one section, though it does show values of 0, could clean it up to show nothing. \ No newline at end of file From 1540cdc61b291b08b6f33298abe85c59e3efa76a Mon Sep 17 00:00:00 2001 From: HM-127BTY Date: Fri, 3 Jul 2026 18:03:17 +0100 Subject: [PATCH 11/11] 3-mandatory-interpret 3-to-pounds.js - added the answers to the question. --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 60c9ace69a..21e85fe593 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -25,3 +25,9 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" +// 3-6. It is taking the vaule from pencestring and using substring to return part of the string, by -1 so from the end resualting in "399" +// 8. It is now adding "0" infront of vaule if the vaule is under 3 characters in size. +// 9-12. Using the substring function to reduce the size of the vaule to just 2 characters. +// 14-16. Taking the value from paddedPenceNumberString and this time with substring, only showing the last 2 characters in teh value. + // Then with using .padEnd it ensures that 2 characters are shown with 0 being there is nothing is there. +// 18. Showing the resualt of the code starting with a "£" then the value of "pounds" then a "." and lastly value of "pence"