From 1a7fa8ae67c1f31a7af4139cb87b119e7c940523 Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Sat, 12 Sep 2026 20:17:13 +0200 Subject: [PATCH 1/3] Added form controls --- Form-Controls/index.html | 42 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 74b591ffc..9c8842030 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -17,11 +17,51 @@

Product Pick

+ +
+ + + + +
+ +
+ + + + +
+
+ + +
+ +
+ + +
+ From a5a7a2e302ae613fd956baec042d1f51a98466ba Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Sat, 12 Sep 2026 20:18:57 +0200 Subject: [PATCH 2/3] Made color choices RGB --- Form-Controls/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 9c8842030..ce81b0a37 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -34,7 +34,7 @@

Product Pick

- + - +
From 22f84a797a7d185c4cb06d06b7fa1d6201732cbe Mon Sep 17 00:00:00 2001 From: Edward Kganyago Date: Wed, 23 Sep 2026 13:22:51 +0200 Subject: [PATCH 3/3] fixed all the errors and interpreted everything in sprint-2 --- Sprint-2/1-key-exercises/1-count.js | 1 + Sprint-2/1-key-exercises/2-initials.js | 5 +++-- Sprint-2/1-key-exercises/3-paths.js | 7 ++++--- Sprint-2/1-key-exercises/4-random.js | 6 ++++++ Sprint-2/2-mandatory-errors/0.js | 4 ++-- Sprint-2/2-mandatory-errors/1.js | 2 +- Sprint-2/2-mandatory-errors/2.js | 4 ++-- Sprint-2/2-mandatory-errors/3.js | 7 ++++++- Sprint-2/2-mandatory-errors/4.js | 6 ++++-- .../3-mandatory-interpret/1-percentage-change.js | 15 ++++++++------- Sprint-2/3-mandatory-interpret/2-time-format.js | 12 +++++++----- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 7 ++++++- 12 files changed, 50 insertions(+), 26 deletions(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..356be081e 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,3 +4,4 @@ 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 adding 1 to the count variable \ No newline at end of file diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 964c9563c..84ab94ba4 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -1,10 +1,11 @@ const firstName = "Creola"; const middleName = "Katherine"; const lastName = "Johnson"; +let initials=firstName.charAt(0)+middleName.charAt(0)+lastName.charAt(0) // 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 = ``; - + //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 ab90ebb28..22ff30ac8 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/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(13,16) ; +const ext =filePath.slice(50,53); +console.log(`the directory of the file path is: ${dir}`) +console.log(`the extension of the file path is: ${ext}`) // https://www.google.com/search?q=slice+mdn \ No newline at end of file diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..9d3764ebc 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -4,6 +4,12 @@ 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? + // Try breaking down the expression and using documentation to explain what it means +//math.floor rounds down the whole number +//math.random generates a random number between 0 and 1 +//max - min +1 =98 +//add 1 // 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 +console.log(num) \ No newline at end of file diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index cf6c5039f..65ad3030d 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? \ No newline at end of file diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..031839b47 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; +let age = 33; age = age + 1; diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..c46e98083 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 ? - -console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +console.log(`I was born in ${cityOfBirth}`); + diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..bdc5d9267 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,9 +1,14 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +const last4Digits = cardNumber.toString().slice(-4); + +//maybe the error isn't running because of the function used to get the last 4 digits + // 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 // 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? +//it says .slice() is not a fnction, i was right // Then try updating the expression last4Digits is assigned to, in order to get the correct value +console.log(last4Digits) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..1ee96d3be 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,4 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const Hour12ClockTime = "8:53pm"; +const hour24ClockTime = "20:53"; + +//cant start variable name with number or special char diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index e24ecb8e1..37f8a6792 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -2,21 +2,22 @@ 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; +const priceDifference = carPrice.toInt() - priceAfterOneYear.toInt(); +const percentageChange = (priceDifference.toInt() / carPrice.toInt()) * 100; 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 - +//2 // 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? - +//maybe the function is doing mathematical operations to string, there wasnt a comma for the second replace function // c) Identify all the lines that are variable reassignment statements - +//4 // d) Identify all the lines that are variable declarations - +//2 // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +//it is removing all the commas and replacing it with an empty space, to make calculations easier \ No newline at end of file diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 47d239558..33ca172b1 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -1,4 +1,4 @@ -const movieLength = 8784; // length of movie in seconds +const movieLength = 1524.545; // length of movie in seconds const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -12,14 +12,16 @@ 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 // b) How many function calls are there? - +//0 // 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 of the time, its a modulus function // d) Interpret line 4, what does the expression assigned to totalMinutes mean? - +//it calculates the total watch time of the movie and it subtracts the remaining seconds and converts the time to minutes // e) What do you think the variable result represents? Can you think of a better name for this variable? - +//watchTime, the length of the movie in minutes no seconds // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer +//it works for all the value i tried diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..3fcbd98f7 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -1,4 +1,4 @@ -const penceString = "399p"; +const penceString = "5000p"; const penceStringWithoutTrailingP = penceString.substring( 0, @@ -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" +//create a variable that identifies the trailing p +//creates the desired length of pence +//creates the decimal, by padding the last 2 numbers +//conerts to punds by pading the first two characters +//print, the price in pounds \ No newline at end of file