From 6278aca64ac60fccd19779e150044c98146db422 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Wed, 16 Sep 2026 18:26:15 +0100 Subject: [PATCH 01/30] adding a h2 --- education-blog/education-blog | 1 + 1 file changed, 1 insertion(+) create mode 160000 education-blog/education-blog diff --git a/education-blog/education-blog b/education-blog/education-blog new file mode 160000 index 000000000..c91a0c6c1 --- /dev/null +++ b/education-blog/education-blog @@ -0,0 +1 @@ +Subproject commit c91a0c6c1cb04b4d1ba91692d26504cbadf8cef6 From 1e2d9f3aacbaae181d69d7d68e2a60b6b27e7d63 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 14:02:23 +0100 Subject: [PATCH 02/30] Adding the answer to exercise1 --- Sprint-2/1-key-exercises/1-count.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..ba5f379ce 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,3 +4,8 @@ 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 + +/* +In line 3 the code is incrmenting the variable "count" by 1 , the operator "=" is assigning a new value to "count" by adding 1. + +*/ From 05b468c6654692786da101d94ff4d89dd0560f10 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 14:04:13 +0100 Subject: [PATCH 03/30] solving the exercise --- Sprint-2/1-key-exercises/2-initials.js | 7 ++++++- 1 file changed, 6 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..ce5f6c405 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -2,9 +2,14 @@ const firstName = "Creola"; const middleName = "Katherine"; 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 = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}` // https://www.google.com/search?q=get+first+character+of+string+mdn + + +console.log(initials) From d1507f1229a33ab89e0733cd102f839e1afeb62e Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 14:05:47 +0100 Subject: [PATCH 04/30] solving the exercise using slice method --- Sprint-2/1-key-exercises/3-paths.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..1f9c8dce6 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,11 @@ 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 = filePath.slice(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 + +console.log(`The dir part of the filePath ${filePath}variable is ${dir}`); + +console.log(`The ext part of a variable file.txt is ${ext}`); \ No newline at end of file From dc792ba7e29a5ec3df80f863ad2debbc1075b4b3 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 14:34:54 +0100 Subject: [PATCH 05/30] solving exercise 4-random --- Sprint-2/1-key-exercises/4-random.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..e46aaa471 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -7,3 +7,29 @@ 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 + +//console.log(num); + +//First operation +// num is generating a random floating number with method Math.random() between 0 and 1 + +let test = Math.random() +console.log(test) + +//Second operation +//The generated number is multiplied by 100 being (maximum =100 -1 +1) + + test =Math.random() *(maximum - minimum +1); + console.log(test) + + //Third operation + //num is rounded down to the nearset whole number using the method Math.floor + + test = Math.floor(Math.random() * (maximum - minimum + 1)) + console.log(test) + + // Last operation is to add 1 to num 1 is stored in a variable called minimum + + test =Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; + console.log(test) + console.log(num) \ No newline at end of file From cfceef285bdfd4e023190436c9bff393388bf2e8 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 15:47:56 +0100 Subject: [PATCH 06/30] solving exercise 0.js --- Sprint-2/1-key-exercises/4-random.js | 12 ++++++------ Sprint-2/2-mandatory-errors/0.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index e46aaa471..1fd5677bf 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -1,4 +1,4 @@ -const minimum = 1; +const minimum = 10; const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; @@ -19,17 +19,17 @@ console.log(test) //Second operation //The generated number is multiplied by 100 being (maximum =100 -1 +1) - test =Math.random() *(maximum - minimum +1); + test =test *(maximum - minimum +1); console.log(test) //Third operation //num is rounded down to the nearset whole number using the method Math.floor - test = Math.floor(Math.random() * (maximum - minimum + 1)) - console.log(test) + test = test+ minimum; + console.log("test+ minimum" , test) // Last operation is to add 1 to num 1 is stored in a variable called minimum - test =Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; + test =Math.floor(test) console.log(test) - console.log(num) \ No newline at end of file + //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..26f73db71 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 From dc92e00905a199f1d213e372ccfa9c62a85ad327 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 15:48:50 +0100 Subject: [PATCH 07/30] solving exercise 1.js --- Sprint-2/2-mandatory-errors/1.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..21386571c 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,4 +1,7 @@ // 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) From 6f3c7bb55e3bb1e13581211740981ad3d8d8ce74 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 15:49:34 +0100 Subject: [PATCH 08/30] solving exercise 2.js --- Sprint-2/2-mandatory-errors/2.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..23c5328be 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/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}`); +//Answer : the error was that CitOfBirth vaiable was declared after the method cosole .log() + //The solution is to declare it before calling it. + const cityOfBirth = "Bolton"; + +console.log(`I was born in ${cityOfBirth}`); + From da764791cc014edcf9c5fae2717645fa5f7735a8 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 16:00:05 +0100 Subject: [PATCH 09/30] solving exercise 3.js --- Sprint-2/2-mandatory-errors/3.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..a0464fe38 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,5 +1,5 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +const last4Digits = cardNumber.toString().slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working @@ -7,3 +7,15 @@ 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 + +/* +Prediction : The slice method is used with String data type. here we have cardNumber varible with type Number. +Running the code will give a TypeError : cardNumber.slice is not a function +The solution is to convert numbe to string, There are three posibility: +String(cardNumber) +cardNumber.toString() +`${cardNumber}` + +*/ + +console.log(last4Digits); \ No newline at end of file From 8fc0ed8759862be8bb268988f33feac25a076a82 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 16:06:48 +0100 Subject: [PATCH 10/30] solving exercise 4.js --- Sprint-2/2-mandatory-errors/4.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..149d812b5 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,6 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; +const HourClockTime12 = "8:53pm"; +const hourClockTime24 = "20:53"; + +/* +the naming of of the varibles is not correct varible should not start with a number +*/ From 51551e18944fb6d65427283f39ab7fa5812d3139 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 16:35:40 +0100 Subject: [PATCH 11/30] sovling exercise 1-percentage-change --- .../1-percentage-change.js | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 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..c9e262803 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/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; @@ -13,10 +13,53 @@ console.log(`The percentage change is ${percentageChange}`); // a) How many function calls are there in this file? Write down all the lines where a function call is made -// 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? +/* +Solution to a) +-------------|-----------------| -------- + 1 | Number() | line 4 | + 2 | replaceAll() | line 4 | + 3 | Number() | line 5 | + 4 | replaceAll() | line 5 | + 5 | console.log() | line 10 | +------------------------------------------ + + +*/ + + +// 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? +/* +Solution to b) + After running the code the terminal gives SyntaxError: missing ) after argument list BUT the actual error is not having a comma in line 5 in the replaceAll methode as it needs two arguments + eplaceAll("," "") => should be eplaceAll("," , "") +*/ // c) Identify all the lines that are variable reassignment statements +/* +Solution to c) +Variable reassignment statements lines are: + +line 4 : carPrice = Number(carPrice.replaceAll(",", "")); +line 5 : priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); +*/ // d) Identify all the lines that are variable declarations +/* + Solution to d) + Variable declarations lines are: + line 1 :let carPrice = "10,000"; + line 2 :let priceAfterOneYear = "8,543"; + line 7 :const priceDifference = carPrice - priceAfterOneYear; +c line 8 :const percentageChange = (priceDifference / carPrice) * 100; + +*/ // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? + +/* +Solution to e) +The expresssion Number(carPrice.replaceAll(",","")) is removing the comma "," in CarPrice i.e from 10,000 to 10000 which is stored +in String type , removing the comma will insure the mathimatical operation will go normal when converted to type Number. + +*/ + From 98b99fed4c6f91841a51b2e9a1e764f83682e51c Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 20:03:59 +0100 Subject: [PATCH 12/30] update solution --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index c9e262803..7e43ff82d 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -16,7 +16,9 @@ console.log(`The percentage change is ${percentageChange}`); /* Solution to a) --------------|-----------------| -------- + +There are 5 function calls in this file: +-------------|-----------------| --------| 1 | Number() | line 4 | 2 | replaceAll() | line 4 | 3 | Number() | line 5 | From 7e1fd302f9c5f3b0de85adc2367f4272db06a391 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 21:56:39 +0100 Subject: [PATCH 13/30] solving exercise 2-time-format --- .../3-mandatory-interpret/2-time-format.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 47d239558..0cd17d786 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -11,15 +11,57 @@ 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? +/************************************************** */ +/* Solution a): There are 6 varibale declarations */ +/************************************************* */ + // b) How many function calls are there? + /**************************************************/ + /* Solution b): */ + /* There is only one fuction 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 +/*********************************************************************************************************************/ +/*Solution c): */ + /* The operator (%) called Modulo returns the remainder left over when one operand is divided by a second operand */ + /* In this expamle it gives the time remainder of the movie in seconds */ +/*********************************************************************************************************************/ + + + // d) Interpret line 4, what does the expression assigned to totalMinutes mean? + /****************************************************************************************************************************************************************************/ + /* Solution d): */ + /* The totalMinutes expression is calaculated first by subtrackting the lengh of movie by the reminder of seconds which rounds down the nearst minutes */ + /* Since we know the total number of seconds that are multiple of 60 we can can calculate the total number of minutes by dividing it over 60 since 1 minute is 60 seconds */ + /* This way we have the Movie total exact number of miutes. */ + /****************************************************************************************************************************************************************************/ + + // e) What do you think the variable result represents? Can you think of a better name for this variable? + /*********************************************************************************************/ + /* Solution e): */ + /* The variable result represents the exact lenght of the movie in Hours + Minutes + Seconds */ + /* A better name for variable result could be : extctMovieLength */ + /*********************************************************************************************/ // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer + +/***************************************************************************************************************************************************************/ + /* Solution e): */ + /* movieLength = 0 => exactMovieLength = 0:0:0 */ + /* movieLength = 60 => exactMovieLength = 0:1:0 */ + /* movieLength = 3676 => exactMovieLength = 1:1:16 */ + /* */ + /* This code work for all values of movieLength provided that it doesn't exeed 86400 which is 24 hours = 1 day (realisticly no movie is over 24 hours) */ + /* */ + /**********************************************************************************************************************************************************/ + From e3bf82a1249f99489709a41eafe10cdff9ec2e71 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sat, 19 Sep 2026 23:41:44 +0100 Subject: [PATCH 14/30] solving exercise 3-to-pounds --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..3d782bbd3 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -6,10 +6,11 @@ const penceStringWithoutTrailingP = penceString.substring( ); const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); -const pounds = paddedPenceNumberString.substring( - 0, + +const pounds = paddedPenceNumberString.substring( 0, paddedPenceNumberString.length - 2 ); +console.log(pounds) const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) @@ -25,3 +26,8 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" +// 2. penceStringWithoutTrailingP = penceString.substring( 0, penceString.length - 1): This line of code slice the penceString varible by removing the "p" character from it. +// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") : This line of code adds "0" if lenght of penceStringWithoutTrailingP is less then 3 i.e e value is "1" => it will convert it to"001" or ifthe value is "22" it will confert it to "022". +// 4. const pounds = paddedPenceNumberString.substring( 0, paddedPenceNumberString.length - 2); : This line of code extract and store the value of pound from paddedPenceNumberString using the substring method since £1 = 100 pences => any number in the hudered position i.e third character from the right onwards has a value of £. +// 5. const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) .padEnd(2, "0");: This line of code extract and store the value of pences paddedPenceNumberString using the substring method => instead of starting from the left it start from the right moving two positions then it adds "0"in case the pences value is less then 10. +// 6. console.log(`£${pounds}.${pence}`): This line of code prints the final result in $ and pences in nice readable way => £3.99 \ No newline at end of file From c6f0fd0613b7b26cadac42ccdabb42071d0de520 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 00:00:28 +0100 Subject: [PATCH 15/30] solve chrom.md --- Sprint-2/4-stretch-explore/chrome.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-2/4-stretch-explore/chrome.md b/Sprint-2/4-stretch-explore/chrome.md index 962580b82..ce193dcfe 100644 --- a/Sprint-2/4-stretch-explore/chrome.md +++ b/Sprint-2/4-stretch-explore/chrome.md @@ -8,8 +8,13 @@ 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? +Answer : it will brings a popup with alert 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? What is the return value of `prompt`? + +Answer: calling the `prompt` function will bring up a dialog box with a field to put an answer + +The return value of `prompt is the variable `myName` From 0290b7c6f40e811ca4a2702a70d39e1c55c5861b Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 00:18:53 +0100 Subject: [PATCH 16/30] solving objects exercise --- Sprint-2/4-stretch-explore/objects.md | 96 ++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/Sprint-2/4-stretch-explore/objects.md b/Sprint-2/4-stretch-explore/objects.md index 0216dee56..5df24e8f7 100644 --- a/Sprint-2/4-stretch-explore/objects.md +++ b/Sprint-2/4-stretch-explore/objects.md @@ -5,12 +5,106 @@ In this activity, we'll explore some additional concepts that you'll encounter i Open the Chrome devtools Console, type in `console.log` and then hit enter What output do you get? +Answer : an object : log() { [native code] } Now enter just `console` in the Console, what output do you get back? +Answer : an object +console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …} +assert +: +ƒ assert() +clear +: +ƒ clear() +context +: +ƒ context() +count +: +ƒ count() +countReset +: +ƒ countReset() +createTask +: +ƒ createTask() +debug +: +ƒ debug() +dir +: +ƒ dir() +dirxml +: +ƒ dirxml() +error +: +ƒ error() +group +: +ƒ group() +groupCollapsed +: +ƒ groupCollapsed() +groupEnd +: +ƒ groupEnd() +info +: +ƒ info() +log +: +ƒ log() +memory +: +MemoryInfo {totalJSHeapSize: 19300000, usedJSHeapSize: 18200000, jsHeapSizeLimit: 3760000000} +profile +: +ƒ profile() +profileEnd +: +ƒ profileEnd() +table +: +ƒ table() +time +: +ƒ time() +timeEnd +: +ƒ timeEnd() +timeLog +: +ƒ timeLog() +timeStamp +: +ƒ timeStamp() +trace +: +ƒ trace() +warn +: +ƒ warn() +Symbol(Symbol.toStringTag) +: +"console" +[[Prototype]] +: +Object Try also entering `typeof console` - + + Answer : object Answer the following questions: What does `console` store? +Answer : The console object does not permanently store data; instead, it provides an interface to record, display, and inspect temporary logs, warnings, and errors in the environment's debugging tool or terminal. What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? + +Answer : + +The console.log() is a method that accepts any value and outputs that the given value to the console + +The console.assert() is a static method that writes an error message to the console if the assertion is false. If the assertion is true, nothing happens. + +The `.` is dot notation — it access the methods that belongs to the console object. such as log, assert, error .... ext From ed20ed5b84169931727464f22112f21289adedad Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 14:01:54 +0100 Subject: [PATCH 17/30] Remove accidentally tracked education-blog/education-blog submodule --- .gitignore | 2 +- education-blog/education-blog | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 160000 education-blog/education-blog diff --git a/.gitignore b/.gitignore index bde36e530..012c20760 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules .DS_Store .vscode -**/.DS_Store \ No newline at end of file +**/.DS_Storeeducation-blog/education-blog diff --git a/education-blog/education-blog b/education-blog/education-blog deleted file mode 160000 index c91a0c6c1..000000000 --- a/education-blog/education-blog +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c91a0c6c1cb04b4d1ba91692d26504cbadf8cef6 From 5329549e0db14d114163009e163230e5a6f69664 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 15:36:03 +0100 Subject: [PATCH 18/30] correcting exercise 2-time-format --- Sprint-2/3-mandatory-interpret/2-time-format.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 0cd17d786..0367b1143 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 = 90000; // length of movie in seconds const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -60,8 +60,13 @@ console.log(result); /* movieLength = 0 => exactMovieLength = 0:0:0 */ /* movieLength = 60 => exactMovieLength = 0:1:0 */ /* movieLength = 3676 => exactMovieLength = 1:1:16 */ + /* movieLength = -3600 => exactMoveLenght = -1:0:0 */ + /* movieLength = 90000 => exactMoveLenght = 25:0:0 */ /* */ - /* This code work for all values of movieLength provided that it doesn't exeed 86400 which is 24 hours = 1 day (realisticly no movie is over 24 hours) */ + /* This code work Could be better: */ + /* - giving a negative value for movieLength will result in a negative clock: so there could have message that reject negative numbers. */ + /* - The program should have represented Hours/Min/Sec in this format 00:00:00 so each time should be represented with 2 digits. */ + /* - 25 hours exeeds 24 hours which represents a day so a variable total days could be added to represent time in days. */ /* */ /**********************************************************************************************************************************************************/ From 1f6a0a394d2599550ce590c4868b4920fba3b324 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 15:40:51 +0100 Subject: [PATCH 19/30] Further correction exercise 2-time-format --- Sprint-2/3-mandatory-interpret/2-time-format.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 0367b1143..403903fd8 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 = 90000; // length of movie in seconds +const movieLength = 90.5; // length of movie in seconds const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -63,10 +63,11 @@ console.log(result); /* movieLength = -3600 => exactMoveLenght = -1:0:0 */ /* movieLength = 90000 => exactMoveLenght = 25:0:0 */ /* */ - /* This code work Could be better: */ + /* This code Could be better: */ /* - giving a negative value for movieLength will result in a negative clock: so there could have message that reject negative numbers. */ /* - The program should have represented Hours/Min/Sec in this format 00:00:00 so each time should be represented with 2 digits. */ /* - 25 hours exeeds 24 hours which represents a day so a variable total days could be added to represent time in days. */ + /* -Values with dicimal numbers will return the clock showing dicimal numbers this should be rounded up or down to the nearst time with an integer number */ /* */ /**********************************************************************************************************************************************************/ From d386bfb42c2ecb5d571ac8f0dec7676e87e86fa6 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 15:47:37 +0100 Subject: [PATCH 20/30] correcting exercise 1.js --- Sprint-2/2-mandatory-errors/1.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 21386571c..5d6c45e53 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -3,5 +3,9 @@ let age = 33; age = age + 1; +/* +Answer : The Error is : TypeError: Assignment to constant variable. +Constants in JavaScript can't be reassigned to correct this we have to change the varible type from const => let. +*/ console.log(age) From b1e0fc1437ee0bdff67ef8053bd8d80157bca02c Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 16:25:38 +0100 Subject: [PATCH 21/30] fixing issues in excersie 4-random --- Sprint-2/1-key-exercises/4-random.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 1fd5677bf..81f0c7ab0 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -1,4 +1,4 @@ -const minimum = 10; +const minimum = 1; const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; @@ -8,28 +8,23 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // 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); +console.log(num); //First operation -// num is generating a random floating number with method Math.random() between 0 and 1 +// num is generating a random dicimal number with method Math.random() between 0 and 1 result eg :0.3948605 + -let test = Math.random() -console.log(test) //Second operation -//The generated number is multiplied by 100 being (maximum =100 -1 +1) +//The generated number is multiplied by the range+1 which is between 1-100 result eg 39.48605 - test =test *(maximum - minimum +1); - console.log(test) //Third operation - //num is rounded down to the nearset whole number using the method Math.floor + //num is rounded down to the nearset whole number using the method Math.floor restult eg 39.48605 => 39 + - test = test+ minimum; - console.log("test+ minimum" , test) - // Last operation is to add 1 to num 1 is stored in a variable called minimum + // Last operation is to add 1 to hit the maximum value (since Math.random() never quite reaches 1). This ensures all 100 numbers (1 through 100) are equally reachable.eg 39 => 40 - test =Math.floor(test) - console.log(test) - //console.log(num) \ No newline at end of file + + From 33458e125dc30331402a5b420bd1b53d4e53c589 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 16:36:19 +0100 Subject: [PATCH 22/30] correcting exercise 3-paths.js --- Sprint-2/1-key-exercises/3-paths.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 1f9c8dce6..b43a90c96 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,11 +17,17 @@ 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.slice(1,lastSlashIndex); + const dir = filePath.slice(0,lastSlashIndex); + /*correction : slice(0,lastSlashIndex); is the correct method to extract the dir path + filePath.slice(start, end) => 0 represents the character 0 of the filePath String put 1 will skip the first charchter. + */ + + const ext = filePath.slice(filePath.lastIndexOf(".")+1); // https://www.google.com/search?q=slice+mdn console.log(`The dir part of the filePath ${filePath}variable is ${dir}`); -console.log(`The ext part of a variable file.txt is ${ext}`); \ No newline at end of file +console.log(`The ext part of a variable file.txt is ${ext}`); + From 21c5ff705dff9a327e101c6e4a3f7796f44ea45c Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 16:53:56 +0100 Subject: [PATCH 23/30] fixing .gitignore issue --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 012c20760..bde36e530 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ node_modules .DS_Store .vscode -**/.DS_Storeeducation-blog/education-blog +**/.DS_Store \ No newline at end of file From 3754064fc4ab53e6c4d6fcbb0dcd2cb20ce86daf Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 21:53:34 +0100 Subject: [PATCH 24/30] correct comment on line 27 4-random.js exercise --- Sprint-2/1-key-exercises/4-random.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 81f0c7ab0..0caf7c6be 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -24,7 +24,6 @@ console.log(num); - // Last operation is to add 1 to hit the maximum value (since Math.random() never quite reaches 1). This ensures all 100 numbers (1 through 100) are equally reachable.eg 39 => 40 - + // Last operation is to add 1 to the generated rounded figure this can be any number from 0 to 99 since the rounding is using Math.Floor and not Math.Ceil we could get a (0) => adding 1 will insure the range is between 1 and 100 i.e minimuam and maximum From c4041a09408269fe1e3cf1b7b6f931613a639af4 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 22:27:02 +0100 Subject: [PATCH 25/30] Correcting comment on line 27 --- Sprint-2/1-key-exercises/4-random.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 0caf7c6be..0eb60842d 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -24,6 +24,4 @@ console.log(num); - // Last operation is to add 1 to the generated rounded figure this can be any number from 0 to 99 since the rounding is using Math.Floor and not Math.Ceil we could get a (0) => adding 1 will insure the range is between 1 and 100 i.e minimuam and maximum - - + // Last operation is to add the + minimum (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. \ No newline at end of file From a727eb09a9b285c98c75cc5b97c050518be93229 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Sun, 20 Sep 2026 22:31:10 +0100 Subject: [PATCH 26/30] correction --- Sprint-2/1-key-exercises/4-random.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 0eb60842d..948911b92 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -24,4 +24,4 @@ console.log(num); - // Last operation is to add the + minimum (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. \ No newline at end of file + // Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. \ No newline at end of file From 5a7662250970b94e4f32fa55527717065a056a65 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Mon, 21 Sep 2026 10:19:49 +0100 Subject: [PATCH 27/30] adding a line at the end that says what num is --- Sprint-2/1-key-exercises/4-random.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 948911b92..6dfa27057 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -24,4 +24,5 @@ console.log(num); - // Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. \ No newline at end of file + // Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. + //eg . num was 39 => 40 \ No newline at end of file From c861b1401e95b7612a76fa7e4b7ccc764c244d6b Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Mon, 21 Sep 2026 10:44:50 +0100 Subject: [PATCH 28/30] applying Prittier formating for the files --- Sprint-2/1-key-exercises/2-initials.js | 7 +- Sprint-2/1-key-exercises/3-paths.js | 8 +-- Sprint-2/1-key-exercises/4-random.js | 15 ++-- Sprint-2/2-mandatory-errors/0.js | 2 +- Sprint-2/2-mandatory-errors/1.js | 2 +- Sprint-2/2-mandatory-errors/2.js | 3 +- Sprint-2/2-mandatory-errors/3.js | 2 +- .../1-percentage-change.js | 3 - .../3-mandatory-interpret/2-time-format.js | 69 +++++++++---------- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 13 ++-- Sprint-2/4-stretch-explore/objects.md | 62 ++++++++--------- 11 files changed, 83 insertions(+), 103 deletions(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index ce5f6c405..53b2ca1ce 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -2,14 +2,11 @@ const firstName = "Creola"; const middleName = "Katherine"; 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 = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}` +const initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`; // https://www.google.com/search?q=get+first+character+of+string+mdn - -console.log(initials) +console.log(initials); diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index b43a90c96..1f97e42ea 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,17 +17,15 @@ 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.slice(0,lastSlashIndex); - /*correction : slice(0,lastSlashIndex); is the correct method to extract the dir path +const dir = filePath.slice(0, lastSlashIndex); +/*correction : slice(0,lastSlashIndex); is the correct method to extract the dir path filePath.slice(start, end) => 0 represents the character 0 of the filePath String put 1 will skip the first charchter. */ - - const ext = filePath.slice(filePath.lastIndexOf(".")+1); +const ext = filePath.slice(filePath.lastIndexOf(".") + 1); // https://www.google.com/search?q=slice+mdn console.log(`The dir part of the filePath ${filePath}variable is ${dir}`); console.log(`The ext part of a variable file.txt is ${ext}`); - diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 6dfa27057..23c8c8fca 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -10,19 +10,14 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; console.log(num); -//First operation +//First operation // num is generating a random dicimal number with method Math.random() between 0 and 1 result eg :0.3948605 - - //Second operation //The generated number is multiplied by the range+1 which is between 1-100 result eg 39.48605 +//Third operation +//num is rounded down to the nearset whole number using the method Math.floor restult eg 39.48605 => 39 - //Third operation - //num is rounded down to the nearset whole number using the method Math.floor restult eg 39.48605 => 39 - - - - // Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. - //eg . num was 39 => 40 \ No newline at end of file +// Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. +//eg . num was 39 => 40 diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index 26f73db71..e9c7b03f2 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 +We don't want the computer to run these 2 lines - how can we solve this problem?*/ diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 5d6c45e53..ec5bd32c3 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -8,4 +8,4 @@ Answer : The Error is : TypeError: Assignment to constant variable. Constants in JavaScript can't be reassigned to correct this we have to change the varible type from const => let. */ -console.log(age) +console.log(age); diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 23c5328be..a9c679e98 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -2,9 +2,8 @@ // what's the error ? //Answer : the error was that CitOfBirth vaiable was declared after the method cosole .log() - //The solution is to declare it before calling it. +//The solution is to declare it before calling it. 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 a0464fe38..4420d21dd 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -18,4 +18,4 @@ cardNumber.toString() */ -console.log(last4Digits); \ No newline at end of file +console.log(last4Digits); diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 7e43ff82d..6d139c41a 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -13,7 +13,6 @@ console.log(`The percentage change is ${percentageChange}`); // a) How many function calls are there in this file? Write down all the lines where a function call is made - /* Solution to a) @@ -29,7 +28,6 @@ There are 5 function calls in this file: */ - // 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? /* Solution to b) @@ -64,4 +62,3 @@ The expresssion Number(carPrice.replaceAll(",","")) is removing the comma "," in in String type , removing the comma will insure the mathimatical operation will go normal when converted to type Number. */ - diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 403903fd8..2559beb56 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -11,63 +11,56 @@ 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? /************************************************** */ /* Solution a): There are 6 varibale declarations */ /************************************************* */ - // b) How many function calls are there? - /**************************************************/ - /* Solution b): */ - /* There is only one fuction call (console.log() */ - /*********************************************** */ +/**************************************************/ +/* Solution b): */ +/* There is only one fuction 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 /*********************************************************************************************************************/ /*Solution c): */ - /* The operator (%) called Modulo returns the remainder left over when one operand is divided by a second operand */ - /* In this expamle it gives the time remainder of the movie in seconds */ +/* The operator (%) called Modulo returns the remainder left over when one operand is divided by a second operand */ +/* In this expamle it gives the time remainder of the movie in seconds */ /*********************************************************************************************************************/ - - // d) Interpret line 4, what does the expression assigned to totalMinutes mean? - /****************************************************************************************************************************************************************************/ - /* Solution d): */ - /* The totalMinutes expression is calaculated first by subtrackting the lengh of movie by the reminder of seconds which rounds down the nearst minutes */ - /* Since we know the total number of seconds that are multiple of 60 we can can calculate the total number of minutes by dividing it over 60 since 1 minute is 60 seconds */ - /* This way we have the Movie total exact number of miutes. */ - /****************************************************************************************************************************************************************************/ - +/****************************************************************************************************************************************************************************/ +/* Solution d): */ +/* The totalMinutes expression is calaculated first by subtrackting the lengh of movie by the reminder of seconds which rounds down the nearst minutes */ +/* Since we know the total number of seconds that are multiple of 60 we can can calculate the total number of minutes by dividing it over 60 since 1 minute is 60 seconds */ +/* This way we have the Movie total exact number of miutes. */ +/****************************************************************************************************************************************************************************/ // e) What do you think the variable result represents? Can you think of a better name for this variable? - /*********************************************************************************************/ - /* Solution e): */ - /* The variable result represents the exact lenght of the movie in Hours + Minutes + Seconds */ - /* A better name for variable result could be : extctMovieLength */ - /*********************************************************************************************/ +/*********************************************************************************************/ +/* Solution e): */ +/* The variable result represents the exact lenght of the movie in Hours + Minutes + Seconds */ +/* A better name for variable result could be : extctMovieLength */ +/*********************************************************************************************/ // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer /***************************************************************************************************************************************************************/ - /* Solution e): */ - /* movieLength = 0 => exactMovieLength = 0:0:0 */ - /* movieLength = 60 => exactMovieLength = 0:1:0 */ - /* movieLength = 3676 => exactMovieLength = 1:1:16 */ - /* movieLength = -3600 => exactMoveLenght = -1:0:0 */ - /* movieLength = 90000 => exactMoveLenght = 25:0:0 */ - /* */ - /* This code Could be better: */ - /* - giving a negative value for movieLength will result in a negative clock: so there could have message that reject negative numbers. */ - /* - The program should have represented Hours/Min/Sec in this format 00:00:00 so each time should be represented with 2 digits. */ - /* - 25 hours exeeds 24 hours which represents a day so a variable total days could be added to represent time in days. */ - /* -Values with dicimal numbers will return the clock showing dicimal numbers this should be rounded up or down to the nearst time with an integer number */ - /* */ - /**********************************************************************************************************************************************************/ - +/* Solution e): */ +/* movieLength = 0 => exactMovieLength = 0:0:0 */ +/* movieLength = 60 => exactMovieLength = 0:1:0 */ +/* movieLength = 3676 => exactMovieLength = 1:1:16 */ +/* movieLength = -3600 => exactMoveLenght = -1:0:0 */ +/* movieLength = 90000 => exactMoveLenght = 25:0:0 */ +/* */ +/* This code Could be better: */ +/* - giving a negative value for movieLength will result in a negative clock: so there could have message that reject negative numbers. */ +/* - The program should have represented Hours/Min/Sec in this format 00:00:00 so each time should be represented with 2 digits. */ +/* - 25 hours exeeds 24 hours which represents a day so a variable total days could be added to represent time in days. */ +/* -Values with dicimal numbers will return the clock showing dicimal numbers this should be rounded up or down to the nearst time with an integer number */ +/* */ +/**********************************************************************************************************************************************************/ diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 3d782bbd3..4811b5193 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -2,15 +2,16 @@ const penceString = "399p"; const penceStringWithoutTrailingP = penceString.substring( 0, - penceString.length - 1 + penceString.length - 1, ); const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); -const pounds = paddedPenceNumberString.substring( 0, - paddedPenceNumberString.length - 2 +const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2, ); -console.log(pounds) +console.log(pounds); const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) @@ -27,7 +28,7 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" // 2. penceStringWithoutTrailingP = penceString.substring( 0, penceString.length - 1): This line of code slice the penceString varible by removing the "p" character from it. -// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") : This line of code adds "0" if lenght of penceStringWithoutTrailingP is less then 3 i.e e value is "1" => it will convert it to"001" or ifthe value is "22" it will confert it to "022". +// 3. const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") : This line of code adds "0" if lenght of penceStringWithoutTrailingP is less then 3 i.e e value is "1" => it will convert it to"001" or ifthe value is "22" it will convert it to "022". // 4. const pounds = paddedPenceNumberString.substring( 0, paddedPenceNumberString.length - 2); : This line of code extract and store the value of pound from paddedPenceNumberString using the substring method since £1 = 100 pences => any number in the hudered position i.e third character from the right onwards has a value of £. // 5. const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) .padEnd(2, "0");: This line of code extract and store the value of pences paddedPenceNumberString using the substring method => instead of starting from the left it start from the right moving two positions then it adds "0"in case the pences value is less then 10. -// 6. console.log(`£${pounds}.${pence}`): This line of code prints the final result in $ and pences in nice readable way => £3.99 \ No newline at end of file +// 6. console.log(`£${pounds}.${pence}`): This line of code prints the final result in £ and pences in nice readable way => £3.99 diff --git a/Sprint-2/4-stretch-explore/objects.md b/Sprint-2/4-stretch-explore/objects.md index 5df24e8f7..2fbe33c46 100644 --- a/Sprint-2/4-stretch-explore/objects.md +++ b/Sprint-2/4-stretch-explore/objects.md @@ -5,96 +5,96 @@ In this activity, we'll explore some additional concepts that you'll encounter i Open the Chrome devtools Console, type in `console.log` and then hit enter What output do you get? -Answer : an object : log() { [native code] } +Answer : an object : log() { [native code] } Now enter just `console` in the Console, what output do you get back? Answer : an object console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …} assert -: +: ƒ assert() clear -: +: ƒ clear() context -: +: ƒ context() count -: +: ƒ count() countReset -: +: ƒ countReset() createTask -: +: ƒ createTask() debug -: +: ƒ debug() dir -: +: ƒ dir() dirxml -: +: ƒ dirxml() error -: +: ƒ error() group -: +: ƒ group() groupCollapsed -: +: ƒ groupCollapsed() groupEnd -: +: ƒ groupEnd() info -: +: ƒ info() log -: +: ƒ log() memory -: +: MemoryInfo {totalJSHeapSize: 19300000, usedJSHeapSize: 18200000, jsHeapSizeLimit: 3760000000} profile -: +: ƒ profile() profileEnd -: +: ƒ profileEnd() table -: +: ƒ table() time -: +: ƒ time() timeEnd -: +: ƒ timeEnd() timeLog -: +: ƒ timeLog() timeStamp -: +: ƒ timeStamp() trace -: +: ƒ trace() warn -: +: ƒ warn() Symbol(Symbol.toStringTag) -: +: "console" [[Prototype]] -: +: Object Try also entering `typeof console` - - Answer : object + +Answer : object Answer the following questions: What does `console` store? @@ -103,7 +103,7 @@ What does the syntax `console.log` or `console.assert` mean? In particular, what Answer : -The console.log() is a method that accepts any value and outputs that the given value to the console +The console.log() is a method that accepts any value and outputs that the given value to the console The console.assert() is a static method that writes an error message to the console if the assertion is false. If the assertion is true, nothing happens. From ce7a6d0bdda059ad11fae5a00e99f4cb22bb9ec8 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Mon, 21 Sep 2026 13:13:50 +0100 Subject: [PATCH 29/30] add num answer --- Sprint-2/1-key-exercises/4-random.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 23c8c8fca..92d3f9d2e 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -20,4 +20,7 @@ console.log(num); //num is rounded down to the nearset whole number using the method Math.floor restult eg 39.48605 => 39 // Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. -//eg . num was 39 => 40 +// eg . num was 39 => 40 +//num is a random whole number from 1 to 100. + + \ No newline at end of file From d7636e9f9f809e7bc6d436e5a65679c2913864a3 Mon Sep 17 00:00:00 2001 From: Abdennour Hachemi Date: Mon, 21 Sep 2026 16:16:37 +0100 Subject: [PATCH 30/30] Further correction of file format --- Sprint-2/1-key-exercises/4-random.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 92d3f9d2e..ae3032815 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -11,7 +11,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; console.log(num); //First operation -// num is generating a random dicimal number with method Math.random() between 0 and 1 result eg :0.3948605 +//num is generating a random dicimal number with method Math.random() between 0 and 1 result eg :0.3948605 //Second operation //The generated number is multiplied by the range+1 which is between 1-100 result eg 39.48605 @@ -19,8 +19,6 @@ console.log(num); //Third operation //num is rounded down to the nearset whole number using the method Math.floor restult eg 39.48605 => 39 -// Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. -// eg . num was 39 => 40 +//Last operation is to add the "minimum" (in this case it's 1 or it can be changed to any changed number e.g 10) this will shift the random number so it starts counting from minimum, instead of from zero. +//eg . num was 39 => 40 //num is a random whole number from 1 to 100. - - \ No newline at end of file