From a9b57700b62b94096e65afea389006e09953c011 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Fri, 11 Sep 2026 17:41:17 +0100 Subject: [PATCH 01/26] Initial commit --- Form-Controls/index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 74b591ffc..65e9cd29e 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -14,6 +14,12 @@

Product Pick

+
+ + + + +
From 5c1e178528ae9b41f139fc05806396968fc76855 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Fri, 11 Sep 2026 18:12:12 +0100 Subject: [PATCH 02/26] Added name and email validation to form in index.html --- Form-Controls/index.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 65e9cd29e..37867e72b 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -15,11 +15,22 @@

Product Pick

- - + Customer details + +
+ + +
+
+ + +
+ - + + + From f9437e6dc82024accdec7022ff4c3aefa0902742 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Fri, 11 Sep 2026 19:01:15 +0100 Subject: [PATCH 03/26] Added colour, size for validation to form in index.html --- Form-Controls/index.html | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 37867e72b..f62b55b01 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -17,19 +17,54 @@

Product Pick

Customer details -
+
+
+ +
+ +
+ + + + +
+ +
+ + + +
+ + + + +
- Customer details - -
- - - + +
+ +
@@ -73,7 +71,7 @@

Product Pick

From 7db0e90d952e93c32300ae8246b16a4f4b582a5b Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 13:27:48 +0100 Subject: [PATCH 05/26] Removed submit button from email --- Form-Controls/README.md | 24 ++++++++++++------------ Form-Controls/index.html | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Form-Controls/README.md b/Form-Controls/README.md index c356f8844..db6cc158b 100644 --- a/Form-Controls/README.md +++ b/Form-Controls/README.md @@ -4,12 +4,12 @@ -- [ ] Interpret requirements and check against a list of criteria -- [ ] Write a valid form -- [ ] Test with Devtools +- [x ] Interpret requirements and check against a list of criteria +- [x ] Write a valid form +- [] Test with Devtools - [ ] Refactor using Devtools -- [ ] Use version control by committing often and pushing regularly to GitHub -- [ ] Develop the habit of writing clean, well-structured, and error-free code +- [x] Use version control by committing often and pushing regularly to GitHub +- [x] Develop the habit of writing clean, well-structured, and error-free code ## Task @@ -39,18 +39,18 @@ Do not write a form action for this project. Let's write out our testable criteria. Check each one off as you complete it. -- [ ] I have only used HTML and CSS. +- [x] I have only used HTML and CSS. - [ ] I have not used any JavaScript. ### HTML -- [ ] My form is semantic HTML. -- [ ] All inputs have associated labels. +- [x] My form is semantic HTML. +- [x] All inputs have associated labels. - [ ] My Lighthouse Accessibility score is 100. -- [ ] I require a valid name. -- [ ] I require a valid email. -- [ ] I require one colour from a defined set of 3 colours. -- [ ] I require one size from a defined set of 6 sizes. +- [x] I require a valid name. +- [x] I require a valid email. +- [x] I require one colour from a defined set of 3 colours. +- [x] I require one size from a defined set of 6 sizes. ### Developers must adhere to professional standards. diff --git a/Form-Controls/index.html b/Form-Controls/index.html index cf9d38da7..101e64a25 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -24,7 +24,7 @@

Product Pick

- +
From 54ded4f33d3a6857a10812a2ef0ebc1faa35f22c Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 13:29:46 +0100 Subject: [PATCH 06/26] Removed spaces in id and name --- Form-Controls/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 101e64a25..6380c5c63 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -30,7 +30,7 @@

Product Pick

- From 98961adcbb3a7611b4d0d23e77eed081eee5ab12 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 13:40:14 +0100 Subject: [PATCH 07/26] left one submit button at the end and removed unnecessary spaces --- Form-Controls/index.html | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 6380c5c63..1dccaa7ad 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -22,7 +22,7 @@

Product Pick

- + @@ -37,12 +37,12 @@

Product Pick

- +
- @@ -51,11 +51,15 @@

Product Pick

- + +
+ + + @@ -64,13 +68,12 @@

Product Pick

- +
- + +

By Sakiya Mayow

From 43145a0338e78aed1920daa1f6a93376d1b2dde3 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 13:44:46 +0100 Subject: [PATCH 08/26] Ran prettier to format document --- Form-Controls/index.html | 91 ++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 54 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 1dccaa7ad..7b07c7bf9 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -1,4 +1,4 @@ - + @@ -13,68 +13,51 @@

Product Pick

- -
- -
- - -
+
+ + +
+
-
- - - - -
+
+ + +
- - - - - - - -
- -
- - - - -
- - - - + + + + + - - - - - - - - +
+ + +
+ +
- - -

By Sakiya Mayow

+

By Sakiya Mayow

From 0dff25d7914aaf7ab01d497eea4fa8c9012f8d01 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 16:15:48 +0100 Subject: [PATCH 09/26] Removed trailing slash on br and regex, added =" to regex as required pattern --- Form-Controls/index.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 7b07c7bf9..d98d4441f 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -19,10 +19,8 @@

Product Pick

type="text" id="fullname" name="Fullname" - required - .*\S.*\S.* - /> -
+ required pattern=".*\S.*\S.*"> +
From 39bfc0d591a0df5704838770857fb9f67d7b3cf6 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 16:25:28 +0100 Subject: [PATCH 10/26] Made sure that the for on the labels is matching --- Form-Controls/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index d98d4441f..bd23521ec 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -29,7 +29,7 @@

Product Pick

- + From 9e4795ceabb9e20a89638b0ad46966fb16000faa Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 16:31:01 +0100 Subject: [PATCH 11/26] cleaned up --- Form-Controls/index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index bd23521ec..b6aa0d76b 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -19,13 +19,14 @@

Product Pick

type="text" id="fullname" name="Fullname" - required pattern=".*\S.*\S.*"> + required + pattern=".*\S.*\S.*">
- +
From f95b8bd8febc8ca178c5cde42cd7506425118475 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 14 Sep 2026 17:24:52 +0100 Subject: [PATCH 12/26] Fixed / > endings and x ticking boxes in README checklist --- Form-Controls/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Form-Controls/README.md b/Form-Controls/README.md index db6cc158b..b871f08fb 100644 --- a/Form-Controls/README.md +++ b/Form-Controls/README.md @@ -4,9 +4,9 @@ -- [x ] Interpret requirements and check against a list of criteria -- [x ] Write a valid form -- [] Test with Devtools +- [x] Interpret requirements and check against a list of criteria +- [x] Write a valid form +- [X] Test with Devtools - [ ] Refactor using Devtools - [x] Use version control by committing often and pushing regularly to GitHub - [x] Develop the habit of writing clean, well-structured, and error-free code @@ -46,7 +46,7 @@ Let's write out our testable criteria. Check each one off as you complete it. - [x] My form is semantic HTML. - [x] All inputs have associated labels. -- [ ] My Lighthouse Accessibility score is 100. +- [X] My Lighthouse Accessibility score is 100. - [x] I require a valid name. - [x] I require a valid email. - [x] I require one colour from a defined set of 3 colours. @@ -59,10 +59,10 @@ Let's write out our testable criteria. Check each one off as you complete it. These practices reflect the level of quality expected in professional work. They ensure your code is reliable, maintainable, and presents a polished, credible experience to users. -- [ ] My HTML code has no errors or warnings when validated using https://validator.w3.org/ -- [ ] My code is consistently formatted -- [ ] My page content is free of typos and grammatical mistakes -- [ ] I commit often and push regularly to GitHub +- [X] My HTML code has no errors or warnings when validated using https://validator.w3.org/ +- [X] My code is consistently formatted +- [X] My page content is free of typos and grammatical mistakes +- [X] I commit often and push regularly to GitHub ## Resources - [MDN: Form controls](https://developer.mozilla.org/en-US/docs/Learn/Forms) From 7d3c05f2abd1a612e75a22ec2a1d515d793e211d Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Sat, 19 Sep 2026 14:06:46 +0100 Subject: [PATCH 13/26] Described what line 3 is doing & = --- Sprint-2/1-key-exercises/1-count.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..3efd03370 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -3,4 +3,10 @@ let count = 0; 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 1 is a declaration and Line 3 is a statement that changes the value of the variable 'count' by adding 1 to its current value. +The variable is changing from 0 to 1 after line 3 is executed after we used 'let' to declare the variable 'count' and then we used the = operator to assign the new value. \ No newline at end of file From c82ae1e66fc8df9b9da8ab4a4da292146e7b80dc Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Sat, 19 Sep 2026 15:34:36 +0100 Subject: [PATCH 14/26] char.At for first, middle, last name and index. & added console.log --- Sprint-2/1-key-exercises/2-initials.js | 10 +++++++++- 1 file changed, 9 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..863666ecf 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -5,6 +5,14 @@ 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. -const initials = ``; +//const initials = ``; // https://www.google.com/search?q=get+first+character+of+string+mdn + + +const initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0); + +console.log (initials); + + + From e5150afa66ae2a043acc776c3a43bd69209ddb0e Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Sun, 20 Sep 2026 22:36:44 +0100 Subject: [PATCH 15/26] slice method to store ext part of the variable --- Sprint-2/1-key-exercises/3-paths.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..199696d08 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,9 @@ 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(1, lastSlashIndex); + +const ext = base.slice(45); + // https://www.google.com/search?q=slice+mdn \ No newline at end of file From 6b9e45c891c644aa91454a151045332c32526e5c Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 01:05:04 +0100 Subject: [PATCH 16/26] Explained what num represents. --- Sprint-2/1-key-exercises/4-random.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..d4a0ecd0c 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -3,7 +3,25 @@ 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 + +Num represents a random whole number between the value of 'minimum' (1) and 'maximum' (100) +By creating a constant variable called 'num' and assigning it the value of the expression, we can generate a random number within the mentioned range. + +When running the program we have to understand how the expression works: + +we have to work out the parentheses first, maximum - minimum + 1, which is equal to 100 - 1 + 1 = 100. +so: Math.floor(Math.random() *100) + 1 + Math.random() produces a pseudo-random decimal number that is greater than or equal to 0 but less than 1. + + Next, we need to multiply the result from Math.random() by 100. This may give us the result of a decimal between 0 and 100. + Next step is to use Math.floor() wich then rounds down the decimal number to the nearest whole integer. This then means that the result will be a whole number between 0 and 99. +But we want 1-100, so we add 1 to the result of Math.floor() this then changes the range to be inclusive of 1 and 100. +After adding 1, we need to round down the number to the nearest interger, this is done by using Math.floor(). After this we will have a whole number between maximum and minimum. +Therefore, the final result of num will be a random whole number between 1 and 100, inclusive. From 57efea5830bc89728a3bc070547b808d050720d1 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 01:16:44 +0100 Subject: [PATCH 17/26] // to not run line --- Sprint-2/2-mandatory-errors/0.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index cf6c5039f..8e6242e15 100644 --- a/Sprint-2/2-mandatory-errors/0.js +++ b/Sprint-2/2-mandatory-errors/0.js @@ -1,2 +1,6 @@ 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 +We don't +// want the computer to run these 2 lines - how can we solve this problem? + +We can add 2 forward slashes , by typing two forward slashes ( // ) at the beginning of the line, we can turn that line into a comment. This then means that the computer will completely ignore that line and not run it. + \ No newline at end of file From 895a75408e1cdb22b01663a6bc2c39dcb18c85c4 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 01:35:57 +0100 Subject: [PATCH 18/26] using 'let' to reassign the value --- Sprint-2/2-mandatory-errors/1.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..f5ac398d5 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,4 +1,15 @@ // trying to create an age variable and then reassign the value by 1 - -const age = 33; +let age= 33; age = age + 1; + +console.log (age); + + + +const means that the variable age is a constant and cannot be reassigned. When we try to reassign the value of age by adding 1 to it, we get an error. +This is because we cannot change the value of a constant variable once we have created it. + +If we want to change the value of age, we need to use let instead of consts when declaring the variable. this then allows us to reassign the value of age by adding 1 to it. + + + From b786029da40b4f87b6137c0a0b656006cebad565 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 02:52:25 +0100 Subject: [PATCH 19/26] fixed error order --- Sprint-2/2-mandatory-errors/2.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..ae316b8d2 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -1,5 +1,17 @@ // Currently trying to print the string "I was born in Bolton" but it isn't working... // what's the error ? +error + console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; + +The reason there is an error is because we are using the wrong order, we are telling Javascript to print the value of cityOfBirth before creating a variable. +So we need to create the variable first, this is because Javascript runs code from top to bottom, so a variable that is declared with const needs to be declared before using it. + + + +right way + +const cityOfBirth = "Bolton"; +console.log (`I was born in ${cityOfBirth}`); \ No newline at end of file From 3d784c26aad9811d3d8a36d6668fea4efdf0d28f Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 03:24:22 +0100 Subject: [PATCH 20/26] change number to string to use the .slice method and fix error --- Sprint-2/2-mandatory-errors/3.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..9af740e87 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,4 +1,4 @@ -const cardNumber = 4533787178994213; +const cardNumber = "4533787178994213"; const last4Digits = cardNumber.slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber @@ -7,3 +7,16 @@ 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 + + +console.log(last4Digits); + +I think that Javascript will give an error because .slice() is normally used with strings, and cardNumber is currently a number. +const cardNumber = 4533787178994213; does not have any quotation marks, so Javascript will treat it as a number. + +When run with console.log(last4Digits); we get --> TypeError : cardNumber.slice is not a function + +.slice is a method used with strings and we need to make cardNumber into a string by adding quotation marks.I + +const cardNumber = 4533787178994213 to const cardNumber = "4533787178994213"; +Now cardNumber is a string, then we can re run the code with console.log(last4Digits); to get the correct code. \ No newline at end of file From 5655f66e52723e9c6d0528103879d2730fa2ae19 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 03:38:24 +0100 Subject: [PATCH 21/26] variables unable to start with a number, caused syntaxerror --- Sprint-2/2-mandatory-errors/4.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..11ee8292c 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,12 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const Hour12ClockTime = "8:53pm"; + +console.log(Hour12ClockTime); + +const hour24ClockTime = "20:53"; + +console.log(hour24ClockTime); + + + + +Variable names cannot start with a number as Javascript doesnt allow it, it can contan number inside the variable but not at the beginning. From 97fd2db494059a14b61ad9540df5d7280a9ddef0 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 10:19:54 +0100 Subject: [PATCH 22/26] answered questions --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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..2b7518e2f 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -12,11 +12,13 @@ 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 5 function calls, two function calls on line 4 = Number(...) and replaceAll(...) two more on line 5 = Number(...) and replaceAll(...) and finally on 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? - +SyntaxError: missing a comma to separate the arguments // c) Identify all the lines that are variable reassignment statements - +carPrice = Number(carPrice.replaceAll(",", "")); and priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); // d) Identify all the lines that are variable declarations - +There are 4 variable declarations- 1) let carPrice = "10,000"; 2) let priceAfterOneYear = "8,543"; +3) const priceDifference = carPrice-priceAfterOneYear; 4) const percentageChange = (priceDifferenc/carPrice)* 100; // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +Number(carPrice.replaceAll(",", "")); is a string and the expression removes the comma from "10,000" and converts "10000" from a string into the number 10000. \ No newline at end of file From fa19a984a3a28564c8e3d0b8104d039a52b39aa8 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 12:40:34 +0100 Subject: [PATCH 23/26] code tested, answered questions --- 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..6b8b7428b 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -12,14 +12,20 @@ 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 variable Declarations, every const creates a new variable. // b) How many function calls are there? - +1 function calls is console.log() as it is a function being called and told to do the job // c) Using documentation, explain what the expression movieLength % 60 represents // 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? +movieLength % 60 means finding the remainder after dividing movieLength by 60. movieLength = 8784 so we need to do: 8784 % 60 = 146.4 and the nearest whole integer is 146. +So there are 146 complete groups of 60. we then multiply; 146 x 60= 8760 --> 8784 - 8760 = 24 so 8784 % 60 = 24 and therefore remainingSeconds becomes 24. +// d) Interpret line 4, what does the expression assigned to totalMinutes mean? +const totalMinutes = (movieLength - remainingSeconds) / 60 ---> if we break it down -> movieLength = 8784 remainingSeconds = 24 +we then subtract remainingSeconds from movieLength= 8784 -24 = 8670. we then have to divide it by 60 which gives us 8760 / 60 = 146. we divide because there is 60 seconds in one minute, and right now we are converting seconds into minutes. // e) What do you think the variable result represents? Can you think of a better name for this variable? - +The result variable will show us he complete results from our calculations of = totalHours:remainingMinutes:remainingSeconds. +result = 2:26:24 // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer +I tested differnet codes: 7965 and I got the result 2:12:45 and i also tried : 2654 and got 0:44:14. \ No newline at end of file From a458b9ad09673244fe13b16fb546564098ef9071 Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 14:48:56 +0100 Subject: [PATCH 24/26] explained step by step breakdown of each line --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 13 +++++++++++++ 1 file changed, 13 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..a3320d06b 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -21,7 +21,20 @@ console.log(`£${pounds}.${pence}`); // The program then builds up a string representing the price in pounds // You need to do a step-by-step breakdown of each line in this program + // 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" +const penceString = "399p"; creates a variable. This string represents a price in pence. +We then count the variable penceString using index starting from 0 and ending at 3. +.length tells us how many characters there are in a string which in this case its 4. +Because we know penceString = 4 we have to then subtract 4-1=3.---> we have penceString.length-1 which then becomes 4 - 1 = 3. +we are doing this so we can remove the final character. +penceString.substring(0, 3) will give us "399" +padStart() adds characters to the beginning of a string until it reaches a certain length, we asked for a length of 3. +The final two characters represents pence and we are trying to get poundsright now.Because we have "399" and the last two digits represents pence and the character before that represents pounds. +we are subtracting 2 because when using substringwe remove the part that belongs to pence, 3 | 99 +padEnd count at the position of the last two digits and take everything after that so we can get the right value for pence. +here we are making sure that pence has 2 characters- this generally means that if the string does not add to 2 characters, add 0 to the end until its 2 characters Long +console.log displays something in the console as the backticks create a template literal inside it we put our variables. From 6f3d83d22dbd7440908a3d7d6de45e84f067884c Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 16:19:32 +0100 Subject: [PATCH 25/26] explained and used chrome console for alert and prompt function --- Sprint-2/4-stretch-explore/chrome.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sprint-2/4-stretch-explore/chrome.md b/Sprint-2/4-stretch-explore/chrome.md index 962580b82..95e05758f 100644 --- a/Sprint-2/4-stretch-explore/chrome.md +++ b/Sprint-2/4-stretch-explore/chrome.md @@ -8,8 +8,17 @@ 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 name and we are storing Hello world! as the argument. alert then alerts the screen with a banner with chrome url that says "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`. +when using prompt and input the argument "what is your name?" and press enter we get a text box where it asks for your name(because of the variable) and a cancel and ok button. you input the question, the function is what prompt() gives back and that is the return value. + What effect does calling the `prompt` function have? + +the prompt function displays a pop-up input box asking "what is your name?" prompt asks a question and users give an input and the prompt then returns that input. + + What is the return value of `prompt`? + +we need to create a variable first ' const myName = prompt ("what is your name?"); that stores the returned value in the variable. \ No newline at end of file From cab49f27a37b8ceeea7aba1d96893442f05fc73e Mon Sep 17 00:00:00 2001 From: Sakiya Mayow Date: Mon, 21 Sep 2026 16:52:52 +0100 Subject: [PATCH 26/26] answered questions about objects --- Sprint-2/4-stretch-explore/objects.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Sprint-2/4-stretch-explore/objects.md b/Sprint-2/4-stretch-explore/objects.md index 0216dee56..6ea010a41 100644 --- a/Sprint-2/4-stretch-explore/objects.md +++ b/Sprint-2/4-stretch-explore/objects.md @@ -6,11 +6,27 @@ Open the Chrome devtools Console, type in `console.log` and then hit enter What output do you get? +it showed the log function rather than calling it f log() { [natice code]} + Now enter just `console` in the Console, what output do you get back? +the console objects and properties/functions ie, {debug:f, error:f, info:f, log:f, warn:f,...} + Try also entering `typeof console` +we get 'object' why?--> because console is an object + Answer the following questions: What does `console` store? -What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? + +console is an object that contains properties/functions used to interact with chrome/browser developer console. + +What does the syntax `console.log` or `console.assert` mean? + +console.log = access the log property inside the console object. +console.assert = access the assert property inside the console object. + +In particular, what does the `.` mean? + +The dot . is called the property accessor operator used to access an object's property. It also tells Javascript to go inside this object and get a particular property.