From 5b7222c428c6c9aacb7f45679dcca115e8d2be54 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 11 Sep 2026 21:50:47 +0100 Subject: [PATCH 01/36] added label name and email and button --- Form-Controls/index.html | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 74b591ffc..6c67ca755 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -14,7 +14,17 @@

Product Pick

- + + + + + +
+
+
From b07d9e098536e15d699bbaf4deb823ee977f9611 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 11 Sep 2026 23:16:04 +0100 Subject: [PATCH 02/36] added -
-
+ + +
+ + +
+
+ + +
+
+ +
From ef3c302aa5c27a5a2ebe0e635a6fc67c1b7d879d Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 12 Sep 2026 00:58:26 +0100 Subject: [PATCH 03/36] added labe; for color and size --- Form-Controls/index.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index e5df5fc11..3eb9ffae2 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -6,6 +6,7 @@ My form exercise +
@@ -21,7 +22,10 @@

Product Pick

- + + +
+
@@ -41,10 +45,11 @@

Product Pick

- - + +
+
From 7737aa955fadc5450a2bcea28c4e7bd6761f1c79 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 12 Sep 2026 01:10:23 +0100 Subject: [PATCH 04/36] style body and button for the index.html --- Form-Controls/formexercise.css | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Form-Controls/formexercise.css diff --git a/Form-Controls/formexercise.css b/Form-Controls/formexercise.css new file mode 100644 index 000000000..3d323582d --- /dev/null +++ b/Form-Controls/formexercise.css @@ -0,0 +1,26 @@ +body{ + line-height:2; + font-size:18px; + font-family:Arial, Helvetica,sans-serif; + border: 1px solid black; + text-align:center; +} +button{ + width:100px; + height:40px; + background-color:white; + text-align:center; + color:black; + font-size:20px; + +} +/* +#name{ + font-size:20px; + font-family:Arial, sans-serif; +} +#email{ + font-size:20px; + font-family:Arial, sans-serif; +} + */ \ No newline at end of file From 444811fd7367dd44e394fe5866be01ff7c3029f3 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 14 Sep 2026 20:46:17 +0100 Subject: [PATCH 05/36] remove comment tags and change footer content --- Form-Controls/index.html | 43 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 3eb9ffae2..72cd67435 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -14,28 +14,20 @@

Product Pick

- - - - - + + - - - -
- - - + +
- - - +
@@ -49,18 +41,13 @@

Product Pick

- -
+
-
- - -
-
- -

By HOMEWORK SOLUTION

-
+ + +
+ From 2cddd89eaef25407845168bf4cd603bd123ee3fd Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 14 Sep 2026 21:07:26 +0100 Subject: [PATCH 06/36] change the pattern in input name to .\*S.\*S*. --- Form-Controls/index.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 72cd67435..1e704a423 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -12,13 +12,13 @@

Product Pick

-
-
- +
+ + - - + pattern=".*\S.*\S*" required title ="Please enter full name"/> + +
From 87ad785806d5096469cf65161d7a3d0df22367d2 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Mon, 14 Sep 2026 21:16:34 +0100 Subject: [PATCH 07/36] remove the comment on line 17. --- Form-Controls/formexercise.css | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Form-Controls/formexercise.css b/Form-Controls/formexercise.css index 3d323582d..d8fcc1703 100644 --- a/Form-Controls/formexercise.css +++ b/Form-Controls/formexercise.css @@ -14,13 +14,3 @@ button{ font-size:20px; } -/* -#name{ - font-size:20px; - font-family:Arial, sans-serif; -} -#email{ - font-size:20px; - font-family:Arial, sans-serif; -} - */ \ No newline at end of file From 45a16256df05d9bb30efac74901eb739eaffc0e0 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 15 Sep 2026 02:07:59 +0100 Subject: [PATCH 08/36] change pattern of input name in to the `.*\S.*\S.*` --- Form-Controls/index.html | 74 ++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 1e704a423..aca281e28 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -1,4 +1,4 @@ - + @@ -6,48 +6,54 @@ My form exercise - +

Product Pick

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

Maharit Belai

-
+
+
+ +
+ +
+
+

Maharit Belai

+
From cac261ef0cd19fdd89a633bd14270c6e780fae80 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Tue, 15 Sep 2026 02:26:48 +0100 Subject: [PATCH 09/36] format document using prettier --- Form-Controls/formexercise.css | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/Form-Controls/formexercise.css b/Form-Controls/formexercise.css index d8fcc1703..87d2b1bb6 100644 --- a/Form-Controls/formexercise.css +++ b/Form-Controls/formexercise.css @@ -1,16 +1,15 @@ -body{ - line-height:2; - font-size:18px; - font-family:Arial, Helvetica,sans-serif; - border: 1px solid black; - text-align:center; +body { + line-height: 2; + font-size: 18px; + font-family: Arial, Helvetica, sans-serif; + border: 1px solid black; + text-align: center; } -button{ - width:100px; - height:40px; - background-color:white; - text-align:center; - color:black; - font-size:20px; - +button { + width: 100px; + height: 40px; + background-color: white; + text-align: center; + color: black; + font-size: 20px; } From 0692f93fbd595aaadc571fdb710ddbb0f25a92c0 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 16:27:08 +0100 Subject: [PATCH 10/36] add comment to 1-count.js --- Sprint-2/1-key-exercises/1-count.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..7e3589730 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 = it is reassigning a value to the variable count \ No newline at end of file From d94c63bc53b4b94263c2fb82ddcfac093befa650 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 17:21:31 +0100 Subject: [PATCH 11/36] add ${} in backticks to creat a template literal to get initials from the strings --- Sprint-2/1-key-exercises/2-initials.js | 4 +++- 1 file changed, 3 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..55364fefd 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -3,8 +3,10 @@ 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[0]}${middleName[0]}${lastName[0]}`; +console.log(initials); // https://www.google.com/search?q=get+first+character+of+string+mdn From 344070043d94e61f1b41288e0855c9216b0af1a8 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 20:22:58 +0100 Subject: [PATCH 12/36] add slice() that would rerturn the dir part of the path --- Sprint-2/1-key-exercises/3-paths.js | 4 ++-- 1 file changed, 2 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..5613f793c 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -16,8 +16,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 = filePath.slice(filePath[1],lastSlashIndex); -const dir = ; const ext = ; - +console.log(`${dir}`); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From 7a6f25aac5be53e683f6ec932d0aabad7303819f Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:17:40 +0100 Subject: [PATCH 13/36] declared dotIndex to save the the index of the dot. --- Sprint-2/1-key-exercises/3-paths.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 5613f793c..9afb5e007 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -14,10 +14,13 @@ const lastSlashIndex = filePath.lastIndexOf("/"); const base = filePath.slice(lastSlashIndex + 1); console.log(`The base part of ${filePath} is ${base}`); -// Create a variable to store the dir part of the filePath variable +gi // Create a variable to store the ext part of the variable -const dir = filePath.slice(filePath[1],lastSlashIndex); -const ext = ; -console.log(`${dir}`); +const dir = filePath.slice(filePath.lastIndexOf("Users"),lastSlashIndex); +console.log(`The dir part of ${filePath} is ${dir}`); +const dotIndex = filePath.lastIndexOf("."); +const ext = filePath.slice(dotIndex + 1); +console.log(`The ext part of the ${filePath} is ${ext}`); + // https://www.google.com/search?q=slice+mdn \ No newline at end of file From f3bef1e68e6a5ea7a1f2180f71ac65768c4f0488 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:24:19 +0100 Subject: [PATCH 14/36] declared a variable startDirIndex to save the start index of the string User --- Sprint-2/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 9afb5e007..d61f48fea 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -16,7 +16,7 @@ console.log(`The base part of ${filePath} is ${base}`); gi // Create a variable to store the ext part of the variable - +const startDirIndex = filePath.lastIndexOf("Users"): const dir = filePath.slice(filePath.lastIndexOf("Users"),lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); const dotIndex = filePath.lastIndexOf("."); From 0fc7d6634f3a511bb64ad331732d9c167338809b Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:26:52 +0100 Subject: [PATCH 15/36] delet content of slice()and replaced it to StartDirIndex --- Sprint-2/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index d61f48fea..3a455ff50 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,7 @@ console.log(`The base part of ${filePath} is ${base}`); gi // Create a variable to store the ext part of the variable const startDirIndex = filePath.lastIndexOf("Users"): -const dir = filePath.slice(filePath.lastIndexOf("Users"),lastSlashIndex); +const dir = filePath.slice(startDirIndex , lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); const dotIndex = filePath.lastIndexOf("."); const ext = filePath.slice(dotIndex + 1); From 9c79a7353d79e0c71b8be50a3010300c5ece77bd Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:28:37 +0100 Subject: [PATCH 16/36] delet 2 notes from the 3-paths.js --- Sprint-2/1-key-exercises/3-paths.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 3a455ff50..a3c100cd5 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -14,8 +14,8 @@ const lastSlashIndex = filePath.lastIndexOf("/"); const base = filePath.slice(lastSlashIndex + 1); console.log(`The base part of ${filePath} is ${base}`); -gi -// Create a variable to store the ext part of the variable + + const startDirIndex = filePath.lastIndexOf("Users"): const dir = filePath.slice(startDirIndex , lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); @@ -23,4 +23,3 @@ const dotIndex = filePath.lastIndexOf("."); const ext = filePath.slice(dotIndex + 1); console.log(`The ext part of the ${filePath} is ${ext}`); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file From 98643379508a3e040bfdf33eaac8a1e124c1d0c3 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:31:05 +0100 Subject: [PATCH 17/36] change colon to semicolon --- Sprint-2/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index a3c100cd5..1aefc7855 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -16,7 +16,7 @@ console.log(`The base part of ${filePath} is ${base}`); -const startDirIndex = filePath.lastIndexOf("Users"): +const startDirIndex = filePath.lastIndexOf("Users"); const dir = filePath.slice(startDirIndex , lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); const dotIndex = filePath.lastIndexOf("."); From c8fd52bafad01113f23440078d431506ad84a233 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:35:30 +0100 Subject: [PATCH 18/36] remove +1 from slice() to make the output include dot(.) --- Sprint-2/1-key-exercises/3-paths.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index 1aefc7855..d15829393 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -20,6 +20,6 @@ const startDirIndex = filePath.lastIndexOf("Users"); const dir = filePath.slice(startDirIndex , lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); const dotIndex = filePath.lastIndexOf("."); -const ext = filePath.slice(dotIndex + 1); +const ext = filePath.slice(dotIndex); console.log(`The ext part of the ${filePath} is ${ext}`); From 4fb372d6d1ff3e349159f8168e5ee83c23a3f634 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:39:01 +0100 Subject: [PATCH 19/36] delet all comment lines --- Sprint-2/1-key-exercises/3-paths.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index d15829393..174c4347e 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -1,25 +1,11 @@ -// The diagram below shows the different names for parts of a file path on a Unix operating system - -// ┌─────────────────────┬────────────┐ -// │ dir │ base │ -// ├──────┬ ├──────┬─────┤ -// │ root │ │ name │ ext │ -// " / home/user/dir / file .txt " -// └──────┴──────────────┴──────┴─────┘ - -// (All spaces in the "" line should be ignored. They are purely for formatting.) - const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt"; const lastSlashIndex = filePath.lastIndexOf("/"); const base = filePath.slice(lastSlashIndex + 1); console.log(`The base part of ${filePath} is ${base}`); - - const startDirIndex = filePath.lastIndexOf("Users"); -const dir = filePath.slice(startDirIndex , lastSlashIndex); +const dir = filePath.slice(startDirIndex, lastSlashIndex); console.log(`The dir part of ${filePath} is ${dir}`); const dotIndex = filePath.lastIndexOf("."); const ext = filePath.slice(dotIndex); console.log(`The ext part of the ${filePath} is ${ext}`); - From c308f99d58bfd42b9d3175cdfaee3aa2b48cccdb Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 21:41:02 +0100 Subject: [PATCH 20/36] remove the comment lines --- Sprint-2/1-key-exercises/2-initials.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 55364fefd..09188f77d 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -2,11 +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[0]}${middleName[0]}${lastName[0]}`; console.log(initials); -// https://www.google.com/search?q=get+first+character+of+string+mdn + From c4aa428893c1e68add5bbb34e4d78dd87e5db9e2 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 22:15:14 +0100 Subject: [PATCH 21/36] explain the expression in order of mathematical operation --- Sprint-2/1-key-exercises/4-random.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..00af1ef82 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -3,7 +3,10 @@ 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 -// It will help to think about the order in which expressions are evaluated +//num represents a number +//lets start by (maximum-minimum +1) which the output is 100. +//math.random()*100 returns random number between 0 and 100 +//math.floor()it rounds a number to thier nearest integer, +//at the end we add 1. + // Try logging the value of num and running the program several times to build an idea of what the program is doing From 8d6342a086b5e206da27a3653639c04e96dc19e2 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 22:23:33 +0100 Subject: [PATCH 22/36] wrote console.log() to see what the code is doing --- 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 00af1ef82..ce7be017b 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -8,5 +8,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; //math.random()*100 returns random number between 0 and 100 //math.floor()it rounds a number to thier nearest integer, //at the end we add 1. +console.log(num) -// Try logging the value of num and running the program several times to build an idea of what the program is doing From e2942bcdee1c4316328ddce98617cbcc66e271d4 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 22:29:22 +0100 Subject: [PATCH 23/36] format document --- Sprint-2/1-key-exercises/1-count.js | 2 +- Sprint-2/1-key-exercises/2-initials.js | 6 ------ Sprint-2/1-key-exercises/4-random.js | 5 ++--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 7e3589730..a1c6cd78d 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,4 +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 = it is reassigning a value to the variable count \ No newline at end of file +// line 3 = it is reassigning a value to the variable count diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 09188f77d..51512e506 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -2,11 +2,5 @@ const firstName = "Creola"; const middleName = "Katherine"; const lastName = "Johnson"; - - - - const initials = `${firstName[0]}${middleName[0]}${lastName[0]}`; console.log(initials); - - diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index ce7be017b..c3776ccbe 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -4,9 +4,8 @@ const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; //num represents a number -//lets start by (maximum-minimum +1) which the output is 100. +//lets start by (maximum-minimum +1) which the output is 100. //math.random()*100 returns random number between 0 and 100 //math.floor()it rounds a number to thier nearest integer, //at the end we add 1. -console.log(num) - +console.log(num); From 18790766d26b1bbb3c3e92a893a218ed53b951e8 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 22:58:17 +0100 Subject: [PATCH 24/36] add a single line comment for both lines --- Sprint-2/2-mandatory-errors/0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 107ef704d6477cc551bba9ca81fad219a6c92d6b Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:03:34 +0100 Subject: [PATCH 25/36] add a comment on why it produces error --- Sprint-2/2-mandatory-errors/1.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..1ea24d955 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -2,3 +2,4 @@ const age = 33; age = age + 1; +// you can not reassign a value to variable that is declared const. \ No newline at end of file From 6e38086a7a48eddb92e63e3126245c4f89f5b872 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:11:17 +0100 Subject: [PATCH 26/36] add more to the comment --- Sprint-2/2-mandatory-errors/2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..136f784d6 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -3,3 +3,4 @@ console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +// The error is that the const declation and initialization came after console.log so no access for cityOfBirth. \ No newline at end of file From 4ed1c21b1db772f9285597a51e44ec550f67ec4b Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:32:28 +0100 Subject: [PATCH 27/36] add comment an answer to a first given question --- Sprint-2/2-mandatory-errors/3.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..c82de81f9 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -7,3 +7,4 @@ 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 +// the code is not working because the number initialized should be in "" . so it can know is as a string. \ No newline at end of file From 1254df6792bf930324f0f09b6a97dda22e140012 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:37:10 +0100 Subject: [PATCH 28/36] write a console .log() to run the code --- Sprint-2/2-mandatory-errors/3.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index c82de81f9..42633e6fc 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -7,4 +7,5 @@ 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 -// the code is not working because the number initialized should be in "" . so it can know is as a string. \ No newline at end of file +// the code is not working because the number initialized should be in "" . so it can know is as a string. +console.log(last4Digits); \ No newline at end of file From 7a988973998a08e6a8e7665dd43c1a38eae6d81f Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:43:21 +0100 Subject: [PATCH 29/36] edit code by enclosing the number by double quote then it will be treated as a string --- Sprint-2/2-mandatory-errors/3.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 42633e6fc..e6cbb613f 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 From 12890910cc33648847c096988710ddd701a8e992 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:46:17 +0100 Subject: [PATCH 30/36] edit the comment and delet the comments that were previously there --- Sprint-2/2-mandatory-errors/3.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index e6cbb613f..23d2cc6ab 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,11 +1,6 @@ const cardNumber = "4533787178994213"; const last4Digits = cardNumber.slice(-4); -// The last4Digits variable should store the last 4 digits of cardNumber -// However, the code isn't working -// 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? -// Then try updating the expression last4Digits is assigned to, in order to get the correct value -// the code is not working because the number initialized should be in "" . so it can know is as a string. +// the code is not working because the number initialized should be in "" . +// so it can know it/or treat it as a string. console.log(last4Digits); \ No newline at end of file From 1ed3c12d146771edf44ad8f2ae006f62eed4df19 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Fri, 18 Sep 2026 23:53:29 +0100 Subject: [PATCH 31/36] add a coment on the error --- Sprint-2/2-mandatory-errors/4.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..cf5cb9a21 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"; + +// The error here is that the variable started with number. From f0507c68991aaca9145405f0ab3c0ddbcd53b661 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 19 Sep 2026 00:57:43 +0100 Subject: [PATCH 32/36] fix the error by putting , in the replaceall() and answer the questions --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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..4ee97b001 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; @@ -12,11 +12,14 @@ console.log(`The percentage change is ${percentageChange}`); // Read the code and then answer the questions below // a) How many function calls are there in this file? Write down all the lines where a function call is made - + // There are two function calls. line 4 and 5 // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? - + //The error iscoming from the line 5, because there was no comma in the replaceAll method . // c) Identify all the lines that are variable reassignment statements + // line 4 and 5 are the variable reassignment statments. // d) Identify all the lines that are variable declarations + // line 1 ,2 ,7 and 8 are lines where variable declarions happened // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? + // the method .replaceAll is replacing the , in the 10,000 and throws it 10000, the number function will convert it into a number. \ No newline at end of file From 158f71d0f431491b10eb97ced0474b5e0ccfe81a Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 19 Sep 2026 01:02:10 +0100 Subject: [PATCH 33/36] delet the question in the comment and edit my answer --- .../3-mandatory-interpret/1-percentage-change.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 4ee97b001..1cb189c13 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -9,17 +9,11 @@ const percentageChange = (priceDifference / carPrice) * 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 - // There are two function calls. line 4 and 5 -// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? - //The error iscoming from the line 5, because there was no comma in the replaceAll method . -// c) Identify all the lines that are variable reassignment statements - // line 4 and 5 are the variable reassignment statments. -// d) Identify all the lines that are variable declarations - // line 1 ,2 ,7 and 8 are lines where variable declarions happened -// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? - // the method .replaceAll is replacing the , in the 10,000 and throws it 10000, the number function will convert it into a number. \ No newline at end of file + // There are two function calls. line 4 and 5 + //The error is coming from the line 5, because there was no comma in the replaceAll() method . + // line 4 and 5 are the variable reassignment statments. + // line 1 ,2 ,7 and 8 are lines where variable declarions happened + // the method .replaceAll is replacing the coma (,) in the 10,000 and throws it 10000, the number function converts it into a number. \ No newline at end of file From 3c79ff2cf914f1f789b18dfc1fb3f3e45196af27 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 19 Sep 2026 01:55:46 +0100 Subject: [PATCH 34/36] run the code and edit my answers --- .../3-mandatory-interpret/2-time-format.js | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 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..a9e2e8b36 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 = 3000; // length of movie in seconds const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -9,17 +9,21 @@ const totalHours = (totalMinutes - remainingMinutes) / 60; const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; 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? -// b) How many function calls are there? -// c) Using documentation, explain what the expression movieLength % 60 represents -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators +//A.There are six variable declararions -// d) Interpret line 4, what does the expression assigned to totalMinutes mean? +//B. no function calls -// e) What do you think the variable result represents? Can you think of a better name for this variable? +// C.The % represents a remainder. The operator returns the remainder leftover when one operand which in + // this cas is movieLength is divided by a second operand in this case 60%. + +// D.it means it is changing the value that was in second into minute by dividing it 60 after the top calculation makes it whole number. + +//E. It represents the duration of the movie.movieLength/movieDuration. + // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer + +// yes it works, i experimented it with various values. I found it to be working properly. \ No newline at end of file From 3231aadb9162d227cd5721d3edaa0355caa42145 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 19 Sep 2026 03:13:19 +0100 Subject: [PATCH 35/36] describ line by line code --- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 16 ++++++++++++++-- 1 file changed, 14 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..22eeed386 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -2,13 +2,13 @@ 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 + paddedPenceNumberString.length - 2, ); const pence = paddedPenceNumberString @@ -25,3 +25,15 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" + +// 2. penceStringWithoutTrailingP : it's value is the return of the method substring()which is 399. +// the substring(0,3-1),when the substring extracts string from index 0 to 2 =>399 and p will be dropped. + +// 3. paddedPenceNumberString : its value is what the padstart() method returns which is the same.399 +//padstart(3,0),it is supossed to add 0's till the needed length is reached which is 3=>399. + +// 4. const Pound is initialized by the out come of the substring()method which is only 3. Because the +// substring start index is zero and end endex is 1. +// 5. const pence will be initialized there are two methods. the first one will extract the string form index 1 +// the second one will add 0 which there is no need=> 99 +//6.consol.log => 3.99 From b55c89afa0003b7ede640d1dd44cda88aa6c9a14 Mon Sep 17 00:00:00 2001 From: Maharit Belai Date: Sat, 19 Sep 2026 15:29:57 +0100 Subject: [PATCH 36/36] revert to origional --- Form-Controls/formexercise.css | 15 ----------- Form-Controls/index.html | 46 ++++++---------------------------- 2 files changed, 7 insertions(+), 54 deletions(-) delete mode 100644 Form-Controls/formexercise.css diff --git a/Form-Controls/formexercise.css b/Form-Controls/formexercise.css deleted file mode 100644 index 87d2b1bb6..000000000 --- a/Form-Controls/formexercise.css +++ /dev/null @@ -1,15 +0,0 @@ -body { - line-height: 2; - font-size: 18px; - font-family: Arial, Helvetica, sans-serif; - border: 1px solid black; - text-align: center; -} -button { - width: 100px; - height: 40px; - background-color: white; - text-align: center; - color: black; - font-size: 20px; -} diff --git a/Form-Controls/index.html b/Form-Controls/index.html index aca281e28..74b591ffc 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -1,4 +1,4 @@ - + @@ -6,7 +6,6 @@ My form exercise -
@@ -14,46 +13,15 @@

Product Pick

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