From 5f983da200654b3d8984375c745cbaf0247f5c45 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 14:46:16 +0100 Subject: [PATCH 01/18] Add explanation for incrementing count variable Added comment explaining the increment operation on the count variable. --- Sprint-1/1-key-exercises/1-count.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6e..dddab4412b 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,6 @@ 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 + +// [ChunYanWong] It is used to increse the value of the variable by 1 + From 01515b555aab3ad7f047e1b744c9dd7423a2e50d Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 14:48:38 +0100 Subject: [PATCH 02/18] Add initials extraction from name components --- Sprint-1/1-key-exercises/2-initials.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f6175..2a716926ea 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -8,4 +8,5 @@ let lastName = "Johnson"; let initials = ``; // https://www.google.com/search?q=get+first+character+of+string+mdn - +// added by ChunYanWong for the solution +initials = firstName.substring(0,1) + middleName.substring(0,1) + lastName.substring(0,1); From 5feeabfd1a7ccabcefd0e3e45fa692e18b7e7e5b Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:24:01 +0100 Subject: [PATCH 03/18] Add dir and ext variable assignments in paths.js Initialize dir and ext variables to extract directory and file extension from filePath. --- Sprint-1/1-key-exercises/3-paths.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-1/1-key-exercises/3-paths.js b/Sprint-1/1-key-exercises/3-paths.js index ab90ebb28e..1d0f61c7a8 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.substring(0, url.lastIndexOf("/") + 1);; +const ext = filePath.substring(filePath.lastIndexOf('.') + 1); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +// https://www.google.com/search?q=slice+mdn From 0a536d0370c16bc99db44ebb7d0c9d178701f0b5 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:26:27 +0100 Subject: [PATCH 04/18] Add explanation for random integer generation [ChunYanWong] Added comment explaining num as a random integer. --- Sprint-1/1-key-exercises/4-random.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-1/1-key-exercises/4-random.js b/Sprint-1/1-key-exercises/4-random.js index 292f83aabb..6c83c30f87 100644 --- a/Sprint-1/1-key-exercises/4-random.js +++ b/Sprint-1/1-key-exercises/4-random.js @@ -7,3 +7,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // 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 + +// [ChunYanWong] num is the random integer number generated in the range of 1 and 100 inclusively From 0165169aee01f88f9607bb850f2d9b970e0103cf Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:27:24 +0100 Subject: [PATCH 05/18] Comment out instructional lines in 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..e6b744a05b 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? From f42c57b74f1c5da40cb4950c8ad180d6976a18a0 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:27:58 +0100 Subject: [PATCH 06/18] Change age variable from 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 8d6a97a26449b24b9695f0dfa81df71b2c013a49 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:28:29 +0100 Subject: [PATCH 07/18] Fix variable usage to correctly log city of birth --- Sprint-1/2-mandatory-errors/2.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/2.js b/Sprint-1/2-mandatory-errors/2.js index e09b89831d..075984f569 100644 --- a/Sprint-1/2-mandatory-errors/2.js +++ b/Sprint-1/2-mandatory-errors/2.js @@ -1,5 +1,4 @@ // 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 a15ae05ad44be8763158dc377deb73adf3fc5ccb Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:40:37 +0100 Subject: [PATCH 08/18] Fix last4Digits extraction from cardNumber Updated last4Digits assignment to correctly extract the last 4 digits of cardNumber. --- Sprint-1/2-mandatory-errors/3.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index ec101884db..c271de68df 100644 --- a/Sprint-1/2-mandatory-errors/3.js +++ b/Sprint-1/2-mandatory-errors/3.js @@ -1,5 +1,5 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +//const last4Digits = cardNumber.slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working @@ -7,3 +7,8 @@ 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 + +// [ChunYanWong] The slice method extract substring starting with the first parameter position +// There is no -4 starting position and hence it will not work + +const last4Digits = cardNumber.slice(cardNumber.length - 4) From 3f314e7727c6ecd47da326f5b7ad4b31000fad8f Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:42:16 +0100 Subject: [PATCH 09/18] Fix variable names for clock time formats --- 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..8f04f980ad 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 twelveHourClockTime = "8:53pm"; +const twentyhourClockTime = "20:53"; From 2d13ab8c3630b8c8bd44d911ff828a3fac68b4d7 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 16:52:00 +0100 Subject: [PATCH 10/18] Fix syntax error in priceAfterOneYear assignment --- Sprint-1/3-mandatory-interpret/1-percentage-change.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-1/3-mandatory-interpret/1-percentage-change.js b/Sprint-1/3-mandatory-interpret/1-percentage-change.js index e24ecb8e18..c839ff7f5c 100644 --- a/Sprint-1/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-1/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; @@ -12,11 +12,16 @@ 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 +//[ChunYanWong] 3 . They are Number, replaceAll and 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? +// [ChunYanWong] syntax error - add the comma to fix it. // c) Identify all the lines that are variable reassignment statements +// [ChunYanWong] line 4 and 5 // d) Identify all the lines that are variable declarations +// [ChunYanWong] line 1,2,7 and 8 // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +// [ChunYanWong] remove the comma for the amounts so that they can be converted to numbers for calculation From 4340677a92fa6ef99d47ce0bad5e9e611e26338d Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 17:04:29 +0100 Subject: [PATCH 11/18] Enhance comments for clarity on time format calculations Added comments to clarify variable declarations, function calls, and expressions related to movie length. --- Sprint-1/3-mandatory-interpret/2-time-format.js | 7 +++++++ 1 file changed, 7 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..8f76676d06 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -12,14 +12,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? +//[ChunYanWong] 6 // b) How many function calls are there? +//[ChunYanWong] 1 // c) Using documentation, explain what the expression movieLength % 60 represents // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators +// [ChunYanWong] the remainder - remaining seconds + // d) Interpret line 4, what does the expression assigned to totalMinutes mean? +// [ChunYanWong] the movielength rounded to the neatest minutes // e) What do you think the variable result represents? Can you think of a better name for this variable? +// [ChunYanWong] the novie length in hours, minutes and seconds and resultHHMMSS may be better // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer +// [ChunYanWong] No, decimal number cannot be handled correctly From 11f2fe4c80c304a60d9dd7a80f26ff94d6f319df Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 17:10:19 +0100 Subject: [PATCH 12/18] Enhance code readability with explanatory comments Added comments to explain the purpose of each step in the code. --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 5 +++++ 1 file changed, 5 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..3342792d7f 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -25,3 +25,8 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" +// [ChunYanWong] line 3 is used to remove the character "p" or the unit penny +// [ChunYanWong] line 8 is used to add three 0 in front of the variable penceStringWithoutTrailingP +// [ChunYanWong] line 9 is used to get the nearest pound from the variable above +// [ChunYanWong] line 14 is used to get the remaining penny after converting to the nearest pound +// [ChunYanWong] line 18 is used to display the result in pound and penny respectively From b8a991f5193b86cb2a8b710743dae8b688a6ec08 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 17:12:36 +0100 Subject: [PATCH 13/18] Update chrome.md with alert and prompt explanations Clarify the effects and return values of alert and prompt functions. --- Sprint-1/4-stretch-explore/chrome.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sprint-1/4-stretch-explore/chrome.md b/Sprint-1/4-stretch-explore/chrome.md index e7dd5feafe..0fa026a6a6 100644 --- a/Sprint-1/4-stretch-explore/chrome.md +++ b/Sprint-1/4-stretch-explore/chrome.md @@ -12,7 +12,14 @@ invoke the function `alert` with an input string of `"Hello world!"`; What effect does calling the `alert` function have? +[ChunYanWong] Display an alert or message box in the browser with the message "Hello world!" + 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? + +[ChunYanWong] Display an input box to capture the user input + What is the return value of `prompt`? + +[ChunYanWobg] Inputted name From 15fb6ca14dc40cf63ce4427a34c671764927e4d9 Mon Sep 17 00:00:00 2001 From: cywong Date: Sun, 5 Jul 2026 17:18:54 +0100 Subject: [PATCH 14/18] Update objects.md with console syntax explanations Added syntax help for console.log and console. --- Sprint-1/4-stretch-explore/objects.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sprint-1/4-stretch-explore/objects.md b/Sprint-1/4-stretch-explore/objects.md index 0216dee56a..7a970c82b1 100644 --- a/Sprint-1/4-stretch-explore/objects.md +++ b/Sprint-1/4-stretch-explore/objects.md @@ -6,11 +6,20 @@ Open the Chrome devtools Console, type in `console.log` and then hit enter What output do you get? +[ChunYanWong] The syntax help for console.log + Now enter just `console` in the Console, what output do you get back? +[ChunYanWong] The syntax help for console + Try also entering `typeof console` Answer the following questions: What does `console` store? + +[ChunYanWong] object + What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? + +[ChunYanWong] The method of the object console or the functions of the object console From ee21a6aaa353425e46dc374b03618575e080044d Mon Sep 17 00:00:00 2001 From: cywong Date: Fri, 10 Jul 2026 18:46:33 +0100 Subject: [PATCH 15/18] Fix dir variable to use filePath instead of url --- Sprint-1/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-1/1-key-exercises/3-paths.js b/Sprint-1/1-key-exercises/3-paths.js index 1d0f61c7a8..a4d06c660d 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 = filePath.substring(0, url.lastIndexOf("/") + 1);; +const dir = filePath.substring(0, filePath.lastIndexOf("/") + 1);; const ext = filePath.substring(filePath.lastIndexOf('.') + 1); // https://www.google.com/search?q=slice+mdn From c9e436f09d55504a063c97ceeb17095f24076400 Mon Sep 17 00:00:00 2001 From: cywong Date: Fri, 10 Jul 2026 18:48:10 +0100 Subject: [PATCH 16/18] Fix last4Digits extraction for cardNumber Convert cardNumber to string before slicing to ensure proper extraction of last 4 digits. --- Sprint-1/2-mandatory-errors/3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index c271de68df..68cbd23673 100644 --- a/Sprint-1/2-mandatory-errors/3.js +++ b/Sprint-1/2-mandatory-errors/3.js @@ -11,4 +11,4 @@ const cardNumber = 4533787178994213; // [ChunYanWong] The slice method extract substring starting with the first parameter position // There is no -4 starting position and hence it will not work -const last4Digits = cardNumber.slice(cardNumber.length - 4) +const last4Digits = cardNumber.toString().slice(cardNumber.length - 4) From ba4eea3de6a98c807edb8af47c8c8f77fd637ae2 Mon Sep 17 00:00:00 2001 From: cywong Date: Fri, 10 Jul 2026 18:48:54 +0100 Subject: [PATCH 17/18] Fix slice method to use cardNumber string length --- Sprint-1/2-mandatory-errors/3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index 68cbd23673..3272ff1246 100644 --- a/Sprint-1/2-mandatory-errors/3.js +++ b/Sprint-1/2-mandatory-errors/3.js @@ -11,4 +11,4 @@ const cardNumber = 4533787178994213; // [ChunYanWong] The slice method extract substring starting with the first parameter position // There is no -4 starting position and hence it will not work -const last4Digits = cardNumber.toString().slice(cardNumber.length - 4) +const last4Digits = cardNumber.toString().slice(cardNumber.toString().length - 4) From 4d1e5f1d8c2dcb9e9583726444e98e47397403ce Mon Sep 17 00:00:00 2001 From: cywong Date: Fri, 10 Jul 2026 18:51:01 +0100 Subject: [PATCH 18/18] Rename variables for clarity in time format --- 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 8f04f980ad..fb0231fe12 100644 --- a/Sprint-1/2-mandatory-errors/4.js +++ b/Sprint-1/2-mandatory-errors/4.js @@ -1,2 +1,2 @@ -const twelveHourClockTime = "8:53pm"; -const twentyhourClockTime = "20:53"; +const hours12ClockTime = "8:53pm"; +const hours24ClockTime = "20:53";