Skip to content

Birmingham | 26-ITP-May | Alexandra Clincu | Sprint 1 | Coursework#1461

Open
AlexandraClincu28 wants to merge 1 commit into
CodeYourFuture:mainfrom
AlexandraClincu28:couresework/sprint-1
Open

Birmingham | 26-ITP-May | Alexandra Clincu | Sprint 1 | Coursework#1461
AlexandraClincu28 wants to merge 1 commit into
CodeYourFuture:mainfrom
AlexandraClincu28:couresework/sprint-1

Conversation

@AlexandraClincu28

@AlexandraClincu28 AlexandraClincu28 commented Jul 4, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

  • Completed all the exercises from Sprint 1.
  • Practised basic JavaScript concepts.
  • Explored Chroome DevTools.
  • Read and interpreted existing codes.

@github-actions

This comment has been minimized.

@AlexandraClincu28 AlexandraClincu28 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 4, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 4, 2026
@AlexandraClincu28 AlexandraClincu28 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 4, 2026
@Joshuafolorunsho Joshuafolorunsho added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jul 6, 2026
Comment on lines 1 to +4
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?
SyntaxError: Unexpected identifier 'is'. JavaScript tries to read the text as code, but it is not valid.
Add // at the beginning of each line make them comments. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Brilliant explanation. Can we apply the fix to line 1, and 2?

Comment on lines +5 to +6
// The above code has a TypeError:Assignment to constant variable.
//The error is because age is declared as a constant variable, which mean cannot be reassigned. To fix this error, we can declare age as a let variable instead. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is correct!
Can we apply the fix to line 3?


console.log(`I was born in ${cityOfBirth}`);
const cityOfBirth = "Bolton";
// The error is a ReferenceError: Cannot access 'cityOfBirth' before initialization. The error happens because cityOfBirth is used before it is declared. We can fix this error by moving the const cityOfBirth line before console.log(). No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is correct!
Can we apply the fix to the file?

Comment on lines +10 to +11
// I think the code won't work because the slice() works only on strings, and cardNumber is a number.
// The error says that slice() its not a function because cardNumber is a number. Converting it to a string("4533787178994213") will fix the problem. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is correct!
Can we apply the fix to file?

@@ -1,2 +1,3 @@
const 12HourClockTime = "8:53pm";
const 24hourClockTime = "20:53";
// SyntaxError:Invalid or unexpected token. This error is because the variable name starts with a number. Variable name cannot start with a number in JavaScript.We can fix the error by using a valid variable const twelveHourClockTime. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is correct as well.
Can we apply the fix to the file?

Comment on lines 14 to +23
// a) How many function calls are there in this file? Write down all the lines where a function call is made

// There are 5 function calls in this file. The function calls are made on the following lines: replaceAll() line 4, Number() line 4, replaceAll() line 5, Number() line 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?

// The error is coming from line 5. The error appears because there is a missing comma in the replaceAll() function. We can fix the problem by adding a comma in the replaceAll() function on line 5.
// c) Identify all the lines that are variable reassignment statements

// The lines that are variable reassignment statements are line 4 and line 5.
// d) Identify all the lines that are variable declarations

// The variable declarations are on line 1, line 2, line 7 and line 8.
// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
//The expression removes the comma from the string from carPrice and converts the string to a number. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Brillant explanation!
One small comment is, you're expected to fix the error in line 5.

Comment on lines 14 to +26
// a) How many variable declarations are there in this program?

// There are 6 variable declarations in this program.
// b) How many function calls are there?

// There is just 1 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

// The expression movieLength % 60 represents the remaining seconds after dividing the movie length by 60.
// d) Interpret line 4, what does the expression assigned to totalMinutes mean?

// The expression calculates the total number of whole minutes by removing the remaining seconds and dividing by 60.
// e) What do you think the variable result represents? Can you think of a better name for this variable?

// The variable result represents the movie length in hours, minutes and seconds. A better name could be movieDuration because its clearly describes what the variable are.
// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// The code works for positive numbers because it converts the movie length from seconds into hours, minutes and seconds. It does not work correctly for negative values or values that are not numbers. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lovely explanations!

@Joshuafolorunsho Joshuafolorunsho added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants