Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
d20c0a3
describing what line 3 is doing (reassignment)
djebsoft Feb 23, 2026
3428f41
producing the string "CKJ"
djebsoft Feb 24, 2026
38427c2
creating variable to store specific part (slice) of string
djebsoft Feb 25, 2026
2f3f08d
building an idea of what a program is doing
djebsoft Feb 25, 2026
44271ba
Convert instructions to comments
djebsoft Feb 25, 2026
e0b3256
Use 'let' for age variable to enable reassignment
djebsoft Feb 25, 2026
21914bb
Correct variable declaration for cityOfBirth
djebsoft Feb 25, 2026
17d93a6
Fix the typeOf variable to be able to use a method
djebsoft Feb 25, 2026
af48176
Rename clock time variables to valid identifiers
djebsoft Feb 25, 2026
4ba270e
Fix syntax error in priceAfterOneYear assignment
djebsoft Feb 26, 2026
67c8968
generating time format for duration of a movie
djebsoft Feb 26, 2026
b72751f
describing the purpose behind each step of the code
djebsoft Feb 27, 2026
35fdc82
Fix variable redeclaration in a function
djebsoft Feb 27, 2026
4fdfb07
declaraing the variable 'result' in capitalise function
djebsoft Feb 27, 2026
d100737
Fix duplicate variable declaration and assigning in convertToPercenta…
djebsoft Feb 27, 2026
3bcd5ba
Fix square function parameter
djebsoft Feb 27, 2026
5809aee
Fix multiply function to return result and log output
djebsoft Feb 27, 2026
eee4034
Correct sum function to return the sum of arguments
djebsoft Feb 27, 2026
db44748
Fix getLastDigit function to return correct last digit
djebsoft Feb 28, 2026
429f649
Implement upperSnakeCase function
djebsoft Mar 1, 2026
92bd8ef
Implement toPounds function
djebsoft Mar 1, 2026
56b74d5
Clarify pad function behavior in comments
djebsoft Mar 1, 2026
5196c63
Clean up comments in time-format.js
djebsoft Mar 1, 2026
122c731
Refactor toPounds function
djebsoft Mar 1, 2026
7d09f40
Remove upperSnakeCase function restore the file to the main version
djebsoft Mar 1, 2026
7b87fbc
Update 2.js
djebsoft Mar 1, 2026
652dbc1
Update 1.js
djebsoft Mar 1, 2026
bbdcc95
Update 2.js
djebsoft Mar 1, 2026
177c368
Update 1.js
djebsoft Mar 1, 2026
3bb9ddf
Update 0.js
djebsoft Mar 1, 2026
fcb6413
formatting using prettier
djebsoft Mar 7, 2026
2292f32
formatting using prettier
djebsoft Mar 7, 2026
f92ac80
formatting using prettier
djebsoft Mar 7, 2026
10386dd
formatting using prettier
djebsoft Mar 7, 2026
b3b93d6
formatting using prettier
djebsoft Mar 7, 2026
3438d6e
formatting using prettier
djebsoft Mar 7, 2026
e8a1bf4
Merge branch 'coursework/sprint-1' of https://github.com/djebsoft/Mod…
djebsoft Mar 7, 2026
3f4904a
formatting using prettier
djebsoft Mar 7, 2026
39274a2
Merge branch 'coursework/sprint-1' of https://github.com/djebsoft/Mod…
djebsoft Mar 7, 2026
8b934c0
formatting using prettier
djebsoft Mar 7, 2026
c4c751f
formatting using prettier and removing suggestion
djebsoft Mar 7, 2026
2c58925
formatting using prettier
djebsoft Mar 7, 2026
e1ef649
formatting using prettier
djebsoft Mar 7, 2026
6f289e8
formatting using prettier
djebsoft Mar 7, 2026
0dfa642
trailing / removed and recomended approach taken
djebsoft Mar 8, 2026
7a2b695
demonstrating precisely what's included and what's excluded.
djebsoft Mar 8, 2026
9d78d99
seggesting to begin a variable name with a lowercase letter.
djebsoft Mar 8, 2026
60af85c
segguesting a descriptive name for the variable
djebsoft Mar 8, 2026
8ce4854
padend method not really needed here
djebsoft Mar 8, 2026
314fa85
Merge branch 'CodeYourFuture:main' into coursework/sprint-1
djebsoft Mar 8, 2026
0d3adae
Revert "Merge branch 'CodeYourFuture:main' into coursework/sprint-1"
djebsoft Mar 8, 2026
99f2a39
Revert "Update 0.js"
djebsoft Mar 8, 2026
ce5e2ad
Revert "Update 1.js"
djebsoft Mar 8, 2026
dd973e6
Revert "Fix multiply function to return result and log output"
djebsoft Mar 8, 2026
a7d7dfd
Revert "declaraing the variable 'result' in capitalise function"
djebsoft Mar 9, 2026
0714db2
Update 0.js
djebsoft Mar 9, 2026
895a3ad
Revert "Update 2.js"
djebsoft Mar 9, 2026
41d60eb
Reapply "Update 2.js"
djebsoft Mar 9, 2026
64c8174
Revert "Update 0.js"
djebsoft Mar 9, 2026
a0791ac
Reapply "Update 0.js"
djebsoft Mar 9, 2026
40804b4
Revert "Update 0.js"
djebsoft Mar 9, 2026
c301336
Reapply "declaraing the variable 'result' in capitalise function"
djebsoft Mar 9, 2026
dc13db4
Reapply "Update 0.js"
djebsoft Mar 9, 2026
784fb4b
Reapply "Update 1.js"
djebsoft Mar 9, 2026
987f735
Reapply "Merge branch 'CodeYourFuture:main' into coursework/sprint-1"
djebsoft Mar 9, 2026
8eed65b
Revert "Merge branch 'CodeYourFuture:main' into coursework/sprint-1"
djebsoft Mar 9, 2026
ad6a628
Revert "Clean up comments in time-format.js"
djebsoft Mar 9, 2026
a68f546
Revert "Clarify pad function behavior in comments"
djebsoft Mar 9, 2026
9256617
Revert "Update 2.js"
djebsoft Mar 9, 2026
0391e7d
Revert "Fix square function parameter"
djebsoft Mar 9, 2026
eac0a04
Reapply "Merge branch 'CodeYourFuture:main' into coursework/sprint-1"
djebsoft Mar 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sprint-1/1-key-exercises/1-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ let count = 0;
count = count + 1;

// Line 1 is a variable declaration, creating the count variable with an initial value of 0
// Describe what line 3 is doing, in particular focus on what = is doing
// the third line used the assignment operator '=' to reassign the variable count to the initial value which is zero incremented by one resulting to the value 1
7 changes: 5 additions & 2 deletions Sprint-1/1-key-exercises/2-initials.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ let lastName = "Johnson";
// Declare a variable called initials that stores the first character of each string.
// This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution.

let initials = ``;
let initials = firstName.charAt(0) + middleName.charAt(0) + lastName.charAt(0);
// or
//let initials = firstName[0] + middleName[0] + lastName[0];
// or but rarely used and not recommended because it might cause bugs
//let initials = firstName[0].concat(middleName[0], lastName[0]);

// https://www.google.com/search?q=get+first+character+of+string+mdn

8 changes: 5 additions & 3 deletions Sprint-1/1-key-exercises/3-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ console.log(`The base part of ${filePath} is ${base}`);
// Create a variable to store the dir part of the filePath variable
// Create a variable to store the ext part of the variable

const dir = ;
const ext = ;
const dir = filePath.slice(0, lastSlashIndex);

// https://www.google.com/search?q=slice+mdn
const lastPointIndex = filePath.lastIndexOf(".");
const ext = filePath.slice(lastPointIndex + 1);

// https://www.google.com/search?q=slice+mdn
11 changes: 11 additions & 0 deletions Sprint-1/1-key-exercises/4-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ 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

// the num represents a value with limited interval and that's why
// the num assigned to a value that's in the dor of an expression
// the math object is invoked to perform some mathematical tasks
// the random method is invoked to get a random number between 0 (inclusive) and 1 (exclusive)
// the random number is multiplied by 100
// the floor method is invoked to round down the result to its nearest integer
// added one to the new result
// the final result of the whole expression is what the variable num assigned to
/* after applying the program several times, I got the idea that the program is generating
a value to the num variable thats always between minimum wich is number 1 (included) and maximum wich is number 100 (included) */
5 changes: 3 additions & 2 deletions Sprint-1/2-mandatory-errors/0.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
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?
// 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?
// to make the computer not running these two line we use inline comments by adding two slashes at the beginning of each line
2 changes: 1 addition & 1 deletion Sprint-1/2-mandatory-errors/1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// trying to create an age variable and then reassign the value by 1

const age = 33;
let age = 33; // we should use the keyword 'let' to declare the variable 'age' to allow reassignment later
age = age + 1;
4 changes: 3 additions & 1 deletion Sprint-1/2-mandatory-errors/2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Currently trying to print the string "I was born in Bolton" but it isn't working...
// what's the error ?

console.log(`I was born in ${cityOfBirth}`);
const cityOfBirth = "Bolton";
console.log(`I was born in ${cityOfBirth}`);

// the error is that the variable 'cityOfBirth' is declared after the statement it is used in
11 changes: 10 additions & 1 deletion Sprint-1/2-mandatory-errors/3.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
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
// 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

/* my prediction about why the code isn't working is because either the new variable is declared with const keyword
or the value of the variable cardNumber is a number not a string whereas the method .slice works only with strings */
// the error it gives 'cardNumber.slice is not a function'
// It gives this error because the computer assumes the coder is trying to invoke a function
// yes it is my second prediction
// updating the expression last4Digits is assigned to, in order to get the correct value is as follows
// method one: puting the value of the variable cardNumber into quotes
// method two: invoking the method .toString() to convert the type of the variable from number to string
8 changes: 6 additions & 2 deletions Sprint-1/2-mandatory-errors/4.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
const 12HourClockTime = "20:53";
const 24hourClockTime = "08:53";
const _12HourClockTime = "20:53"; // identifier can not begin with a number
//or
// const twelveHourClockTime = "20:53"; // this would be a valid identifier
const _24hourClockTime = "08:53"; // identifier can not begin with a number
// or
// const twentyFourHourClockTime = "08:53"; // this would be a valid identifier
17 changes: 15 additions & 2 deletions Sprint-1/3-mandatory-interpret/1-percentage-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -12,11 +12,24 @@ 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 five function calls in this file, the lines where a call function is made are as follows:
// line 4, replaceAll()
// line 4, Number()
// line 5, replaceAll()
// line 5, Number()
// line 10, console.log()

// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
// the error is coming from line 5
// it is a syntax error, the expression priceAfterOneYear.replaceAll("," "") ismissing a comma
// to fix this problem we add comma between the two arguments

// c) Identify all the lines that are variable reassignment statements
// the lines that are variable reassignment statements: -line 4 -line 5

// d) Identify all the lines that are variable declarations

// the lines that are variable declarations: -line 1 -line 2 -line 7 -line 8
//
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
// the expression calls the replace method to replace the comma with empty string
// converting the new string to a number to be able to perform math operations
8 changes: 8 additions & 0 deletions Sprint-1/3-mandatory-interpret/2-time-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,22 @@ console.log(result);
// For the piece of code above, read the code and then answer the following questions

// a) How many variable declarations are there in this program?
// there are 6 variable declaration

// b) How many function calls are there?
// there is one function call (console.log())

// c) Using documentation, explain what the expression movieLength % 60 represents
// it represents the remaining of dividing movielength by 60
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators

// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
// it means the integer quotient of dividing movieLength by 60

// e) What do you think the variable result represents? Can you think of a better name for this variable?
// it represents the length of the movie in hours, minutes and seconds format
// a better name would be: formattedTime

// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// no it will not work for negative input values as it gives negative results
//
6 changes: 6 additions & 0 deletions Sprint-1/3-mandatory-interpret/3-to-pounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ console.log(`£${pounds}.${pence}`);

// To begin, we can start with
// 1. const penceString = "399p": initialises a string variable with the value "399p"
// line 3: calling substring method to remove the 'p' letter and keep only digits in the string
// line 8: using padstart method to make the minimum length of the string to 3 characters by adding one zero or two to the left.
// line 9: using substring method to take only the integer part
// line 14: using substring method to take only the decimal part and padend method actualy is not needed here because the decimal part will always be 2 characters long
// line 18: calling console function to print the integer part that represents the pound and the decimal part that represents the pence seprated by point
//