From 9f9df24b8f3ae73297ed4aae4881f6180b475b3f Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Thu, 12 Feb 2026 23:01:44 +0000 Subject: [PATCH 01/15] Increasing the variable count by 1 --- 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 117bcb2b6..0a339bdac 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -2,5 +2,8 @@ let count = 0; count = count + 1; +/* The line 3 is increasing the variable count by 1 and assigning the result to count variable on the left hand * side. + */ + // 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 From dd440df95eb37a4a607c3dacbc60b65439143f54 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Fri, 13 Feb 2026 00:14:56 +0000 Subject: [PATCH 02/15] Added 2-initials.js file --- .gitignore | 5 ++++- Sprint-1/1-key-exercises/2-initials.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index bde36e530..2ff82044a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ node_modules .DS_Store .vscode -**/.DS_Store \ No newline at end of file +**/.DS_Store +.gitignore +.git + diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f617..73d5c2975 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -5,7 +5,8 @@ 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]}`; +console.log(initials); // https://www.google.com/search?q=get+first+character+of+string+mdn From 98cd32095af7887362e38a6234a926edac1eeeca Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 20:21:58 +0000 Subject: [PATCH 03/15] Moved solution to the bottom --- Sprint-1/1-key-exercises/1-count.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 0a339bdac..98fc0d7bb 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -2,8 +2,10 @@ let count = 0; count = count + 1; -/* The line 3 is increasing the variable count by 1 and assigning the result to count variable on the left hand * side. - */ - // 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 + +/* Solution of the problem: + * The line 3 is increasing the variable count by 1 and assigning the result to count variable on the left hand * side. + */ + From 59c58f0d013fe03ad9200d9f6284060c4a8df553 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 21:54:50 +0000 Subject: [PATCH 04/15] 3-paths of Sprint-1 committed --- Sprint-1/1-key-exercises/3-paths.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sprint-1/1-key-exercises/3-paths.js b/Sprint-1/1-key-exercises/3-paths.js index ab90ebb28..a2a452719 100644 --- a/Sprint-1/1-key-exercises/3-paths.js +++ b/Sprint-1/1-key-exercises/3-paths.js @@ -17,7 +17,8 @@ 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); +const ext = base.slice(base.lastIndexOf(".") + 1); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +console.log(`The dir part of the ${filePath} is ${dir} and the extension is ${ext}`); +// https://www.google.com/search?q=slice+mdn From 8a8de079be1e298ba1609af078184c84276e63bd Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 22:33:54 +0000 Subject: [PATCH 05/15] 4-random.js committed --- Sprint-1/1-key-exercises/4-random.js | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Sprint-1/1-key-exercises/4-random.js b/Sprint-1/1-key-exercises/4-random.js index 292f83aab..1e03773b7 100644 --- a/Sprint-1/1-key-exercises/4-random.js +++ b/Sprint-1/1-key-exercises/4-random.js @@ -3,7 +3,38 @@ const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; +console.log(num); + +for (let i = 0; i < 10; i++) { + console.log(Math.floor(Math.random() * (maximum - minimum + 1)) + minimum); +} + // 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 +/** These set the range between 1 to 100 + * const minimum = 1; + * const maximum = 100; + * + * The expression inside Math.random() (maxim - minimum + 1) calculates the range like: 100 - 1 + 1 = 100 + * And the function Math.random() returns a random decimal number between 0 (inclusive) and 1 (exclusive) but never exactly 1 + * The multiplication inside the inner parenthesis Math.random() * (maximum - minimum + 1) computes the ranges between 0 (inclusive) and 100 (exclusive) + * + * The function Math.floor() rounds down to the nearest integer like: + * 14.9 -> 14 + * 88.3 -> 88 + * + * Adding the minimum the Math.floor(...) + minimum changes the range from (0, 99) to (1, 100) + * + * Actually the order of calculation is the following: + * 1. (maximum - minimu + 1) + * 2. Math.random() is called + * 3. Then the multiplication occurs + * 4. The function Math.floor() is applied + * 5. And the minimum is added at end + * + * Each time the program is run it'll produce a different number between 1 and 100. + */ + // 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 1bf725a9511dfac666a83e8a9def1e93a7414989 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 22:50:34 +0000 Subject: [PATCH 06/15] 0.js file committed --- Sprint-1/2-mandatory-errors/0.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/0.js b/Sprint-1/2-mandatory-errors/0.js index cf6c5039f..c92aee5a0 100644 --- a/Sprint-1/2-mandatory-errors/0.js +++ b/Sprint-1/2-mandatory-errors/0.js @@ -1,2 +1,19 @@ -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? + + // There are 3 ways to do that. + + // 1. Using double slash at beginning of each line + // 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? + + // 2. Using single slash and asterisk at beginner and asterisk and slash at end with this line inside + /** + * + * 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? + */ + + // 3. Using backtick at beginner and end of these two lines. + `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 f251145b1dc3e67ce979e512d12fc615e9bad02a Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 22:57:57 +0000 Subject: [PATCH 07/15] 1.js committed --- Sprint-1/2-mandatory-errors/1.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/1.js b/Sprint-1/2-mandatory-errors/1.js index 7a43cbea7..dc3621e4d 100644 --- a/Sprint-1/2-mandatory-errors/1.js +++ b/Sprint-1/2-mandatory-errors/1.js @@ -1,4 +1,11 @@ // trying to create an age variable and then reassign the value by 1 -const age = 33; +/** const age = 33; age = age + 1; +*/ + +let age = 33; // javascript keyword "const" can't be reassign instead we need to use the keyword "let" +age = age + 1; + +console.log(age); + From a9a03908094dc78e99e3224630297c27f40d3264 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 22:58:16 +0000 Subject: [PATCH 08/15] 2.js committed --- Sprint-1/2-mandatory-errors/2.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/2.js b/Sprint-1/2-mandatory-errors/2.js index e09b89831..0fa6b14f2 100644 --- a/Sprint-1/2-mandatory-errors/2.js +++ b/Sprint-1/2-mandatory-errors/2.js @@ -1,5 +1,10 @@ // 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}`); +/** console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +*/ + +const cityOfBirth = "Bolton"; // the declaration must be assign before to be able to call it +console.log(`I was born in ${cityOfBirth}`); + From 29fab0f0250949970a8f9e361a593898f0b036a2 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 23:15:36 +0000 Subject: [PATCH 09/15] 3.js file committed --- Sprint-1/2-mandatory-errors/3.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index ec101884d..bfb187427 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 cardNumber = 4533787178994213; +// 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,18 @@ 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 + +/** + * When I run this code I get: + * + * TypeError: cardNumber.slice is not a function. + * + * To fix the error we need to convert the number data type to string first, then use slice function like below + */ + + +const cardNumber = 4533787178994213; +const last4Digits = cardNumber.toString().slice(-4); + +console.log(last4Digits); + From 4a7201ff23798f6b69f8a6928853fb43f17be170 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Sun, 15 Feb 2026 23:28:54 +0000 Subject: [PATCH 10/15] 4.js committeed --- Sprint-1/2-mandatory-errors/4.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/4.js b/Sprint-1/2-mandatory-errors/4.js index 21dad8c5d..3fb1938eb 100644 --- a/Sprint-1/2-mandatory-errors/4.js +++ b/Sprint-1/2-mandatory-errors/4.js @@ -1,2 +1,10 @@ -const 12HourClockTime = "20:53"; -const 24hourClockTime = "08:53"; \ No newline at end of file +// const 12HourClockTime = "20:53"; +// const 24hourClockTime = "08:53"; + +/** + * I've changed the variable names to tweelveHourClockTime and twentyFourHourClockTime since JavaScript doesn't allow variable names starting with numbers. + */ + +const twelveHourClockTime = "20:53"; +const twentyFourHourClockTime = "08:53"; + From 2e06202caa4bd2c8298df587ec6d27aec69411f2 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Mon, 16 Feb 2026 19:48:26 +0000 Subject: [PATCH 11/15] 3-mandatory-interpret/1-percentage-change.js committed --- .../1-percentage-change.js | 21 +++++++- .../3-mandatory-interpret/2-time-format.js | 31 +++++++++++ Sprint-1/3-mandatory-interpret/3-to-pounds.js | 53 +++++++++++++++++++ Sprint-1/4-stretch-explore/chrome.md | 28 ++++++++++ Sprint-1/4-stretch-explore/objects.md | 41 ++++++++++++++ 5 files changed, 173 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 e24ecb8e1..cb18e5b83 100644 --- a/Sprint-1/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-1/3-mandatory-interpret/1-percentage-change.js @@ -2,7 +2,8 @@ let carPrice = "10,000"; let priceAfterOneYear = "8,543"; carPrice = Number(carPrice.replaceAll(",", "")); -priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); +// priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); +priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); const priceDifference = carPrice - priceAfterOneYear; const percentageChange = (priceDifference / carPrice) * 100; @@ -12,11 +13,29 @@ 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 +/** + * There are two functions call: Number() and replaceAll() + * And the function call is made on lines 4 and 5 + */ // 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? +/** + * The error is coming from line 5 and it's because it's missing a comma between the inner rounded braces ("," ""). + * To fix it is easy: Just insert a comma between the double commas (",", "") + */ // c) Identify all the lines that are variable reassignment statements +/** + * The reassignment lines are 4 and 5 + */ // d) Identify all the lines that are variable declarations +/** + * Lines 1, 2, 7 and 8 + */ // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +/** + * First the expression apply the function replaceAll(",", "") to strip out all comma in the string + * assign to a variable carPrice then the function Number() convert the string into a number. + */ diff --git a/Sprint-1/3-mandatory-interpret/2-time-format.js b/Sprint-1/3-mandatory-interpret/2-time-format.js index 47d239558..8331ed95e 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -12,14 +12,45 @@ 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? +/** + * There are six variable declarations + */ // b) How many function calls are there? +/** + * There is only one function call console.log() + */ // c) Using documentation, explain what the expression movieLength % 60 represents // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators +/** + * It represents the remainder when movieLength is divided by 60 to extract the seconds from a total number of seconds. + */ // d) Interpret line 4, what does the expression assigned to totalMinutes mean? +/** + * 1. This line calculates the total number of whole minutes in the movie by subtracting the remainder seconds from the total seconds and giving the number of seconds that cna be evenly divided into minutes (a multiple of 60) - movieLength - remainingSeconds + * 2. Then divides that result by 60 to convert from seconds to minutes - / 60 + */ // e) What do you think the variable result represents? Can you think of a better name for this variable? +/** + * result is too vague and tells us almost nothing. + * Better name can be: + * timeDisplay - shows it's meant to display time + * movieDuration - relates what is being calculated. + */ // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer +/** + * No leading zeros for single digits: + * + * Current output: "2:5:7" for 2 hours, 5 minutes, 7 seconds + * Standard time format expects: "02:05:07" + * + * No validation for invalid inputs: + * + * movieLength = -30; // "-0:-0:-30" (doesn't make sense) + * movieLength = 60.5; // "0:1:0.5" (shows decimal seconds) + * movieLength = "abc"; // NaN:NaN:NaN (it breaks completely) + */ diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..1237e3440 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -24,4 +24,57 @@ console.log(`£${pounds}.${pence}`); // Try and describe the purpose / rationale behind each step // To begin, we can start with +// // 1. const penceString = "399p": initialises a string variable with the value "399p" +// +// This represents a price in pence (the "p" at the end indicates pence in UK pricing style). + +/** + * 2. const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1); + * + * penceString.length is 4 (characters: '3', '9', '9', 'p'). + * penceString.length - 1 is 3. + * penceString.substring(0, 3) extracts characters from index 0 up to but not including index 3: characters at indices 0, 1, 2 → '3', '9', '9'. + * Removes the trailing 'p' so the numeric part "399" can be processed. + */ + +/** + * 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); + * + * penceStringWithoutTrailingP is "399". + * "399".padStart(3, "0") ensures the string is at least 3 characters long, padding from the left with '0' if needed. + * Since "399" is already length 3, it stays "399". + * Objective: It normalizes pence values like "99p" (which becomes "099") so pounds/pence splitting works correctly. + */ + +/** + * 4. const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); + * + * paddedPenceNumberString.length is 3. + * paddedPenceNumberString.length - 2 is 1. + * paddedPenceNumberString.substring(0, 1) extracts characters from index 0 to 1 exclusive → index 0 only → '3'. + * For "399", pounds part is "3". + * For "099" (if originally "99p"), pounds part would be "0". + */ + +/** + * 5. const pence = paddedPenceNumberString + * + * .substring(paddedPenceNumberString.length - 2) + * .padEnd(2, "0"); + * + * paddedPenceNumberString.length - 2 is 1. + * paddedPenceNumberString.substring(1) extracts from index 1 to end → "99". + * "99".padEnd(2, "0"): it ensures string is at least length 2, padding at end with '0' if needed. + * In this case, it's already length 2, so stays "99". + * If pence part were "5", it would become "50" (pence always shown as 2 digits). + */ + +/** + * 6. console.log(`£${pounds}.${pence}`); + * + * Uses template literal to format output as £3.99. + * Joins pounds and pence with a decimal point. + */ + + diff --git a/Sprint-1/4-stretch-explore/chrome.md b/Sprint-1/4-stretch-explore/chrome.md index e7dd5feaf..8f23ef1bf 100644 --- a/Sprint-1/4-stretch-explore/chrome.md +++ b/Sprint-1/4-stretch-explore/chrome.md @@ -16,3 +16,31 @@ Now try invoking the function `prompt` with a string input of `"What is your nam What effect does calling the `prompt` function have? What is the return value of `prompt`? + +ANSWER: + +1. alert("Hello world!"); + +When you type this into the console and press Enter: +A small pop-up window (dialog box) appears in the Chrome browser window. +It will show the message: "Hello world!". +Then there is an OK button to dismiss it. +The console shows undefined after the dialog is closed because alert() itself does not return a value (i.e., it returns undefined). +The alert function is used to show a simple message to the user. +Execution of JavaScript is paused until the user clicks OK. + +2. let myName = prompt("What is your name?"); + +When you type this and press Enter: +Another pop-up dialog appears, but this time with a text input field. +It will display the prompt message: "What is your name?". +There will be an OK button and a Cancel button. +After you type something and press OK (or just press OK without typing), the dialog closes. +If you type a name and press OK, the return value (stored in myName) is the string you entered. +If you press Cancel, the return value is null. +If you press OK without typing anything, the return value is an empty string "". + +3. Checking the return value + +After running prompt, type myName in the console and press Enter. It will show the value you entered (or null or ""). + diff --git a/Sprint-1/4-stretch-explore/objects.md b/Sprint-1/4-stretch-explore/objects.md index 0216dee56..de91022b9 100644 --- a/Sprint-1/4-stretch-explore/objects.md +++ b/Sprint-1/4-stretch-explore/objects.md @@ -14,3 +14,44 @@ Answer the following questions: What does `console` store? What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? + +ANSWERS: + +When you type console.log and hit enter: +You get back the function definition for log: + +ƒ log() { [native code] } + +This shows that console.log is a built-in function (native code) that outputs messages to the console. + +When you type just console and hit enter: +You get back an object containing many methods and properties: + +Console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …} + +Expanding this reveals all the available console methods like assert, clear, count, group, table, time, trace, etc. + +When you type typeof console: +You get back: + +"object" + +ANSWERING THE QUESTIONS: + +1. What does console store? + +console stores an object that contains methods (functions) for debugging and logging information to the browser's developer console. It's a built-in object provided by the browser's JavaScript environment that gives developers tools to output messages, test code, measure performance, and debug applications. + +2. What does the syntax console.log or console.assert mean? In particular, what does the . mean? + +The dot (.) is the property accessor or member operator in JavaScript. It's used to access properties (which can be values or functions/methods) of an object. +So: +console is an object +. means "access a property of this object" +log is a property of the console object that happens to be a function (method) +console.log together means "access the 'log' property from the 'console' object" +When we execute console.log("Hello"), we're: +Starting with the console object +Using the dot operator to access its log property (which is a function) +Calling that function with the argument "Hello" + From a172214768a9fdf06a16db5ab5e29c0a52fcb8a9 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Wed, 25 Feb 2026 21:58:02 +0000 Subject: [PATCH 12/15] Change 7 and 8 to 8 and 9 on line 34 --- Sprint-1/3-mandatory-interpret/1-percentage-change.js | 2 +- 1 file changed, 1 insertion(+), 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 cb18e5b83..8d59cba71 100644 --- a/Sprint-1/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-1/3-mandatory-interpret/1-percentage-change.js @@ -31,7 +31,7 @@ console.log(`The percentage change is ${percentageChange}`); // d) Identify all the lines that are variable declarations /** - * Lines 1, 2, 7 and 8 + * Lines 1, 2, 8 and 9 */ // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? From f64e25a3a49ff1a92fcb9a69f81db46c4671e306 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Wed, 25 Feb 2026 22:08:53 +0000 Subject: [PATCH 13/15] Correct misspeling cna to can --- Sprint-1/3-mandatory-interpret/2-time-format.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/2-time-format.js b/Sprint-1/3-mandatory-interpret/2-time-format.js index 8331ed95e..d2fc67d50 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -29,7 +29,7 @@ console.log(result); // d) Interpret line 4, what does the expression assigned to totalMinutes mean? /** - * 1. This line calculates the total number of whole minutes in the movie by subtracting the remainder seconds from the total seconds and giving the number of seconds that cna be evenly divided into minutes (a multiple of 60) - movieLength - remainingSeconds + * 1. This line calculates the total number of whole minutes in the movie by subtracting the remainder seconds from the total seconds and giving the number of seconds that can be evenly divided into minutes (a multiple of 60) - movieLength - remainingSeconds * 2. Then divides that result by 60 to convert from seconds to minutes - / 60 */ @@ -46,7 +46,7 @@ console.log(result); * No leading zeros for single digits: * * Current output: "2:5:7" for 2 hours, 5 minutes, 7 seconds - * Standard time format expects: "02:05:07" + * Normally standard time format expects: "02:05:07" * * No validation for invalid inputs: * From 5c53aa7ed47db9499e6ce1e8172507f91167c5c5 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Wed, 25 Feb 2026 22:23:16 +0000 Subject: [PATCH 14/15] Reorganise the code --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 1237e3440..43e4b297a 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -26,7 +26,7 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // // 1. const penceString = "399p": initialises a string variable with the value "399p" -// + // This represents a price in pence (the "p" at the end indicates pence in UK pricing style). /** @@ -34,7 +34,7 @@ console.log(`£${pounds}.${pence}`); * * penceString.length is 4 (characters: '3', '9', '9', 'p'). * penceString.length - 1 is 3. - * penceString.substring(0, 3) extracts characters from index 0 up to but not including index 3: characters at indices 0, 1, 2 → '3', '9', '9'. + * penceString.substring(0, 3) extracts characters from index 0 up to but not including index 3. * Removes the trailing 'p' so the numeric part "399" can be processed. */ @@ -44,7 +44,7 @@ console.log(`£${pounds}.${pence}`); * penceStringWithoutTrailingP is "399". * "399".padStart(3, "0") ensures the string is at least 3 characters long, padding from the left with '0' if needed. * Since "399" is already length 3, it stays "399". - * Objective: It normalizes pence values like "99p" (which becomes "099") so pounds/pence splitting works correctly. + * Objective: It normalizes in UK currrency such that the pence values like "99p" (which becomes "099") so pounds/pence splitting works correctly. */ /** @@ -67,7 +67,7 @@ console.log(`£${pounds}.${pence}`); * paddedPenceNumberString.substring(1) extracts from index 1 to end → "99". * "99".padEnd(2, "0"): it ensures string is at least length 2, padding at end with '0' if needed. * In this case, it's already length 2, so stays "99". - * If pence part were "5", it would become "50" (pence always shown as 2 digits). + * If pence part were "5", it would become "50" (pence shown as 2 digits). */ /** @@ -77,4 +77,3 @@ console.log(`£${pounds}.${pence}`); * Joins pounds and pence with a decimal point. */ - From 076bcb6107847d5f19f895a78e0e5148e99f8059 Mon Sep 17 00:00:00 2001 From: Carlos Abreu Date: Wed, 25 Feb 2026 22:33:52 +0000 Subject: [PATCH 15/15] Made the explanation clear --- Sprint-1/4-stretch-explore/chrome.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Sprint-1/4-stretch-explore/chrome.md b/Sprint-1/4-stretch-explore/chrome.md index 8f23ef1bf..9a7d8bafa 100644 --- a/Sprint-1/4-stretch-explore/chrome.md +++ b/Sprint-1/4-stretch-explore/chrome.md @@ -21,26 +21,26 @@ ANSWER: 1. alert("Hello world!"); -When you type this into the console and press Enter: +When we type this into the console and press Enter: A small pop-up window (dialog box) appears in the Chrome browser window. It will show the message: "Hello world!". -Then there is an OK button to dismiss it. +Then there is an OK button to close it. The console shows undefined after the dialog is closed because alert() itself does not return a value (i.e., it returns undefined). The alert function is used to show a simple message to the user. Execution of JavaScript is paused until the user clicks OK. 2. let myName = prompt("What is your name?"); -When you type this and press Enter: +When we type this and press Enter: Another pop-up dialog appears, but this time with a text input field. It will display the prompt message: "What is your name?". There will be an OK button and a Cancel button. -After you type something and press OK (or just press OK without typing), the dialog closes. -If you type a name and press OK, the return value (stored in myName) is the string you entered. -If you press Cancel, the return value is null. -If you press OK without typing anything, the return value is an empty string "". +When typed something and press OK (or just press OK without typing), the dialog closes. +If you type a name and press OK, the return value (stored in myName) is the string entered. +If pressed Cancel, the return value is null. +If pressed OK without typing anything, the return value is an empty string "". 3. Checking the return value -After running prompt, type myName in the console and press Enter. It will show the value you entered (or null or ""). +After running prompt, type myName in the console and press Enter. It will show the value that I have entered (or null or "").