Skip to content

London | 26-ITP-May | Gideon Defar | Sprint 1 | Coursework#1553

Open
gideondefar wants to merge 7 commits into
CodeYourFuture:mainfrom
gideondefar:coursework/sprint-1
Open

London | 26-ITP-May | Gideon Defar | Sprint 1 | Coursework#1553
gideondefar wants to merge 7 commits into
CodeYourFuture:mainfrom
gideondefar:coursework/sprint-1

Conversation

@gideondefar

Copy link
Copy Markdown

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

In this PR, I have completed the required Sprint 1 coursework exercises.

  • Resolved debugging and initialization order errors within the mandatory errors folder.
  • Added comprehensive documentation and step-by-step breakdowns for the math logic (such as remainder operations and random integer formulas) and string manipulation files.
  • Verified all JavaScript code runs cleanly using Node.js without terminal crashes.

Questions

How do you recommend formatting long multi-line explanations or breakdowns for formulas in the code? Is a detailed block comment preferred over individual single-line comments according to the style guide?

@gideondefar gideondefar added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 1 Assigned during Sprint 1 of this module labels Jul 23, 2026
// 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[0]+ middleName[0]+ lastName[0];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we keep the spacing around the + operators consistent here to improve readability?

const ext = ;

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It looks like lastDotIndex has not been defined before it is used here.

const 12HourClockTime = "8:53pm";
const 24hourClockTime = "20:53";
const HourClockTime = "8:53pm";
const hourClockTime = "20:53";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we name these variables more consistently and make the time format clear in each name?


carPrice = Number(carPrice.replaceAll(",", ""));
priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));
//priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," ""));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Generally it’s good practice to remove commented-out code once it’s no longer needed. It helps keep the code clean and makes it easier for others to read.

b) The uncaught syntax error is coming from line 5. The error occurs because there is a missing comma in the replaceAll method.
It should be carPrice.replaceAll(",", "") instead of carPrice.replaceAll("," ""). To fix this, add the missing comma.
c) The variable reassignment statements are on lines 4 and 5, where carPrice and priceAfterOneYear are being reassigned to their numeric values.
d) The variable declarations are on lines 1 and 2, where carPrice and priceAfterOneYear are declared using the let keyword.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How would you categorise const declarations? Would you consider them variables, values or something else?


/*
a) There are two functions Line 4 & 5:
for eg, The expression Number(carPrice.replaceAll(",","")) is doing the following:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Take another look at the function calls in this file. How many function calls are there in total?

@webmonch

Copy link
Copy Markdown

I believe 0.js and 3.js in the mandatory errors section also require a solution. I also noticed that not all of the files run without errors. As a general practice, it’s worth running each file before pushing your changes to make sure there are no syntax or runtime errors.

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. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants