Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions Sprint-1/1-key-exercises/1-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ count = count + 1;

// Line 1 is a variable declaration, creating the count variable with an initial value of 0
// Describe what line 3 is doing, in particular focus on what = is doing

//line 3 is a statment. It is adding 1 to the value of the variable count
Copy link
Contributor

@jennethydyrova jennethydyrova Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation about the addition! One thing to refine: is = doing the adding or is it doing something else? What's the difference between + and = in this line?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @jennethydyrova ,
the + is adding and the = is Assing the new valeu to the variable "count

17 changes: 13 additions & 4 deletions Sprint-1/1-key-exercises/2-initials.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@


// 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.
// https://www.google.com/search?q=get+first+character+of+string+mdn

let firstName = "Creola";
let middleName = "Katherine";
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 = ``;

// https://www.google.com/search?q=get+first+character+of+string+mdn
let initials= `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`;
//test
//let initialsSecond = `${firstName.charAt(3)} ${middleName.charAt(2)} ${lastName.charAt(4)}`;

console.log (initials);



16 changes: 11 additions & 5 deletions Sprint-1/1-key-exercises/3-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@
// └──────┴──────────────┴──────┴─────┘

// (All spaces in the "" line should be ignored. They are purely for formatting.)

//home / user /dir / file.txt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous comment, is this and everything after line 27 needed for the solution? If not, let's remove it to keep the PR focused.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;) done

const filePath = "/Users/mitch/cyf/Module-JS1/week-1/interpret/file.txt";
const lastSlashIndex = filePath.lastIndexOf("/");
const lastSlashIndex = filePath.lastIndexOf("/"); //=index 47 /
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
const dir = filePath.slice(0, lastSlashIndex + 1);
console.log(`The directory part is: ${dir}`);

// Create a variable to store the ext part of the variable
const lastDotIndex = filePath.lastIndexOf("."); // look for the last Dot
const extPart = filePath.slice(lastDotIndex + 1);
console.log(`The extension part is: ${extPart}`);

const dir = ;
const ext = ;
// https://www.google.com/search?q=slice+mdn

// https://www.google.com/search?q=slice+mdn
13 changes: 13 additions & 0 deletions Sprint-1/1-key-exercises/4-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,21 @@ const minimum = 1;
const maximum = 100;

const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
//const num = Math.floor(Math.random() * (maximum - minimum)) + minimum;
console.log(num);

// In this exercise, you will need to work out what num represents?

//Num represents a random number between 1 to 100 inclde both becasue we are adding 1

// Try breaking down the expression and using documentation to explain what it means

//(maximum - minimum + 1) = get maximum number 100 extract the minimum 1 add +1 to incluide 100.
//+ minimum add 1

//math.radom = gets randm number between 0 and 1 but never 1 so we add +1 to incluide 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're onto something here, but I think you're mixing two ideas. Math.random() never returning 1 is true, but that's not why we have +1 in the formula. What would happen if the formula was Math.random() * (maximum - minimum) + minimum? Try it with max=100, min=1. What range of numbers would you actually get?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Della-Bella you might have skipped this comment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi Jennete, I modified the code without the -1 and got it would never get 100 random would go up to 99. got t know. So the +1 is essential to the maximum value can be 100. thank you

//Math.floor= will raounds donw to the nearest whole number


// 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
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?
//coment the lines
5 changes: 4 additions & 1 deletion Sprint-1/2-mandatory-errors/1.js
Original file line number Diff line number Diff line change
@@ -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);

// error if we intend to change the value assing to a variable we need to use "LET"
5 changes: 4 additions & 1 deletion Sprint-1/2-mandatory-errors/2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// 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}`);

// Error trying to use the variable "cityOfBirth"before declare it
13 changes: 11 additions & 2 deletions 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 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


// it will not work becase Slice is a string methodo.
// To work here need to convert the number to string
Comment on lines +12 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spot on!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @jennethydyrova, for your time reviewing my work. Ib will remember about the extra and personal coments. Make the PR's clear ;)


const cardNumber = 4533787178994213;
const last4Digits = cardNumber.toString().slice(-4);

console.log(last4Digits);
11 changes: 9 additions & 2 deletions Sprint-1/2-mandatory-errors/4.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
const 12HourClockTime = "20:53";
const 24hourClockTime = "08:53";
// const 12HourClockTime = "20:53";
// const 24hourClockTime = "08:53";

const hour12ClockTime = "20:53";
const hour24ClockTime = "08:53";

console.log(hour12ClockTime,hour24ClockTime);

// variable names can't start with nunmbers
10 changes: 9 additions & 1 deletion 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,19 @@ 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
// 3 functions:
Copy link
Contributor

@jennethydyrova jennethydyrova Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close! Double-check what makes something a function call. Look for the pattern: functionName(). One of your answers isn't a function call, and you're missing one that is.

// carPrice = Number(carPrice.replaceAll(",", ""));
// priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
// const percentageChange = (priceDifference / carPrice) * 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a function call?


// 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?
//Error was in line 5 missing a coman between the get to replace ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in comma


// c) Identify all the lines that are variable reassignment statements
// lines 4, 5

// d) Identify all the lines that are variable declarations
// lines 1 and 2 , 7 and 8

// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
// it is converting the numbers prices to real numbers replace the commnas to empty string so takrs the commans out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're on the right track but can you be more specific about:

  1. What data type does carPrice start as?
  2. What data type does it become after this expression?
  3. What happens first: removing commas or converting to a number?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you missed this comment. Your explanation just reads the line but doesn't explain what it actually does.

20 changes: 18 additions & 2 deletions Sprint-1/3-mandatory-interpret/2-time-format.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const movieLength = 8784; // length of movie in seconds
const movieLength = 8784; // decaring length of movie in seconds

const remainingSeconds = movieLength % 60;
const remainingSeconds = movieLength % 60; // decalring the remaining seconds
const totalMinutes = (movieLength - remainingSeconds) / 60;

const remainingMinutes = totalMinutes % 60;
Expand All @@ -12,14 +12,30 @@ 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?
// 4 on lines : 1, 3 and 6 and 9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, variables are declared on lines 1, 3, 6, and 9, but are those all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, this comment is not addressed.



// b) How many function calls are there?
//2
// lines 4 and 7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might be confusing brackets in operations with function calls. You identified 2 function calls on lines 4 and 7 Let's check:

Line 4: const totalMinutes = (movieLength - remainingSeconds) / 60;
Line 7: const totalHours = (totalMinutes - remainingMinutes) / 60;

Are these actually function calls? What's the pattern for a function call?


// c) Using documentation, explain what the expression movieLength % 60 represents
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
// uUses the operator "Reminder". divinfding the month lenth by 60 ( minutes) to get homw many second reminds in the month lengh=
// 8784 / 60 = 146 minutes and remind 24 seconds letf
Comment on lines +24 to +25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good attempt! A few things to clarify:

  • "divinfding the month lenth" - did you mean "movie length"? Be careful about typos
  • "remind" should be "remainder"
  • Your math is correct (8784 % 60 = 24), but can you explain what the % operator does in simpler terms? What does "remainder" mean?



// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
// line 4 find how many total minutes has in the month lenght.
// first gets te toal seconds less the reminds sconds. it gives the results of total seconds and divides it
//by the 60 ( minutes) = results homw many minutes has in the total lenght or movieTotalLength
//8784 - 24 ==== 8760
// 8760 / 60 equals 146 minutes

// e) What do you think the variable result represents? Can you think of a better name for this variable?
// represents how long in time is the movie. could be caled= const timeMovie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thinking about naming! Look at how other variables are named in this code (like totalMinutes). Can you make "timeMovie" follow the same naming style? (Hint: in JS naming convention for variables usually follows descriptor + noun pattern)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe movieTotalLength


// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// i guess it wouldnt worrk for negative numbers but actualy evething envolves time is dificult to
//my mind explain. I need to search for more simples expamples to associete this Reminder operetar in time.
// this was a dificult mind flows to me :(
Comment on lines +39 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on negative numbers!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

;)

16 changes: 15 additions & 1 deletion Sprint-1/3-mandatory-interpret/3-to-pounds.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const penceString = "399p";
const penceString = "9p";

const penceStringWithoutTrailingP = penceString.substring(
0,
Expand All @@ -25,3 +25,17 @@ console.log(`£${pounds}.${pence}`);

// To begin, we can start with
// 1. const penceString = "399p": initialises a string variable with the value "399p"

//lines 3 to 6= we asing a variable "penceStringWithoutTrailingP".
//we use substring to start from index 0 and get the lenght 4 - 1 = 3
// so sbtstring start form 0 and the length has 3 = 399


// line 8. We declare variale "const paddedPenceNumberString" make sure the number number has least 3 digits
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You said padStart "makes sure the number has at least 3 digits", that's correct. But why do we need exactly 3 digits? Try running the code with penceString = "9p" and trace through what happens.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it "fills" 0.09p add the 0,0 to be sure it has 3 digits for money format.


//line 9 to 12= use substring to extrac from start form index 0 and string lenght taking 2 digits = reusl 3

/// lines 14 to 16= const to the pence: the start indext for Substring will be 3-2= 1
// true i got confused . padend make sure the pence part has 2 digits. if it dosen;t padend will add the 0 to it. if it has already 2 digits will stay the same

// line 18 = template literal with the results £3.99
3 changes: 3 additions & 0 deletions Sprint-1/4-stretch-explore/chrome.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ In the Chrome console,
invoke the function `alert` with an input string of `"Hello world!"`;

What effect does calling the `alert` function have?
Pop up a alert mesage

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`?
I typed my name the outbput in the conselo comes undefined
14 changes: 14 additions & 0 deletions Sprint-1/4-stretch-explore/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ Answer the following questions:

What does `console` store?
What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean?


My ansers come form AI as i dintn't undestand the excercise but now I know :

What does console store?
console stores an object. This object contains various properties, many of which are functions (also known as methods when they belong to an object). These functions provide utilities for debugging and logging information to the developer console.

What does the syntax console.log or console.assert mean?
In particular, what does the . mean?
The syntax console.log or console.assert means you are accessing a property (in this case, a function) of the console object.

The . (dot) is called the property accessor or member access operator. It is used to access properties or methods that belong to an object. In simple terms, it means "look inside this object for something named..."

So, console.log means "access the log function that is a part of the console object."
Loading
Loading