Skip to content

London | 26-ITP-Sep| Abdennour Hachemi| Sprint 2 | Coursework - #1547

Open
AbdennourHachemi wants to merge 23 commits into
CodeYourFuture:mainfrom
AbdennourHachemi:coursework/sprint-2
Open

AbdennourHachemi wants to merge 23 commits into
CodeYourFuture:mainfrom
AbdennourHachemi:coursework/sprint-2

Conversation

@AbdennourHachemi

@AbdennourHachemi AbdennourHachemi commented Sep 20, 2026

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

Task code

CYF-1039

A solution to all exercies in Sprint 2. Thanks for reviwing it!

@netlify

netlify Bot commented Sep 20, 2026

Copy link
Copy Markdown

Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit 21c5ff7
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6ab0019e0ca1970008adc319
😎 Deploy Preview https://deploy-preview-1547--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AbdennourHachemi AbdennourHachemi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 20, 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 Sep 20, 2026
@AbdennourHachemi AbdennourHachemi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 20, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work, this is thorough. The table of function calls in 1-percentage-change.js is a good way to answer a), all five are right, and 2-mandatory-errors/3.js is a model answer: a prediction, the exact error, and three different ways to fix it.

A few things to fix:

  1. .gitignore is in this PR and it is not part of the task. See my comment.

  2. 1-key-exercises/3-paths.js line 20, see my comment.

  3. 1-key-exercises/4-random.js, see my comment.

  4. 2-mandatory-errors/1.js, see my comment.

  5. 3-mandatory-interpret/2-time-format.js answer f), see my comment.

  6. Could you run Prettier on the files you have changed? Eleven of them are not formatted at the moment.

Add the Needs Review label again when you have pushed.

Comment thread .gitignore Outdated
.DS_Store
.vscode
**/.DS_Store No newline at end of file
**/.DS_Storeeducation-blog/education-blog

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two things here. This file is not part of the Sprint 2 task, which is what the bot at the top of the page is complaining about. Run git checkout main -- .gitignore to put it back, then commit and push.

Also worth seeing what happened: your new entry got joined onto the end of the previous line, so the file now reads **/.DS_Storeeducation-blog/education-blog as a single pattern. That matches nothing, so **/.DS_Store has stopped working too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorted, .gitignore matches main again and the bot is happy.

Comment thread Sprint-2/1-key-exercises/3-paths.js Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Run this file and read the dir line. It prints Users/mitch/... but the path starts with a /, so the first character is missing. What is the 1 doing as the first argument to slice, and what would happen if it were 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's the one. dir prints the whole path now.

Comment thread Sprint-2/1-key-exercises/4-random.js Outdated
test = test+ minimum;
console.log("test+ minimum" , test)

// Last operation is to add 1 to num 1 is stored in a variable called minimum

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This line says 1 is stored in minimum, but you changed line 1 to const minimum = 10, so the two no longer agree.

There is something else worth checking here. Look at the order you do the steps in. On line 28 you add minimum, then on line 33 you use Math.floor. Now look at line 4: which of those two happens first there? Does the order change the answer?

And your comments walk through the steps well, but they never say what num ends up being. What is the smallest value it can have, and the largest?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The order is right now and you have said what num ends up being. One thing left on the last step, see my new comment on line 27.

// trying to create an age variable and then reassign the value by 1

const age = 33;
let age = 33;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix is right and the file runs. This section also asks you to interpret the error and explain why it happened, and there is nothing written down here. You did that well in 2.js, 3.js and 4.js, so the same again. What did node print before you changed const to let?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, the message and the reason are both written down now.

/* movieLength = 60 => exactMovieLength = 0:1:0 */
/* movieLength = 3676 => exactMovieLength = 1:1:16 */
/* */
/* This code work for all values of movieLength provided that it doesn't exeed 86400 which is 24 hours = 1 day (realisticly no movie is over 24 hours) */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your three examples above are all correct, I ran them. This conclusion is not right though. Try 90000 and see what you get; going over 24 hours is fine.

Look again at your own 60 => 0:1:0 example. Is that how a clock shows one minute? And try a negative number, and one with a decimal like 90.5.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much better. I ran -3600 and 90000 and got what you wrote.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 20, 2026
@AbdennourHachemi AbdennourHachemi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 20, 2026
@AbdennourHachemi AbdennourHachemi removed the Reviewed Volunteer to add when completing a review with trainee action still to take. label Sep 20, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That's four of the five sorted, thanks. The f) answer in 2-time-format.js is a good one now, it names four separate things that break and your two new examples are both right.

Two things left:

  1. 1-key-exercises/4-random.js line 27, see my comment.

  2. The formatting. "My code is consistently formatted" is on the README checklist, and the tool that does it for you is called Prettier. It rearranges spacing and indentation to one agreed style, so your code is easy to read and so a reviewer only sees the changes you meant to make. Eleven of your files still fail that check.

    Prettier comes with the CYF extension pack you were asked to install during onboarding. If you are not sure you have it, open VS Code, go to Extensions, and search for CodeYourFuture Extension Pack. Install it if it is not there: https://marketplace.visualstudio.com/items?itemName=CodeYourFuture.cyf-extension-pack

    Then open each file in Sprint-2, right click in the editor, choose Format Document, and pick Prettier if VS Code asks which formatter to use. Save, commit the changes it makes, and push. To make this happen every time you save, follow the format on save steps here: https://github.com/CodeYourFuture/Module-JavaScript-Fundamentals/blob/main/practical_guide.md

Add the Needs Review label again once you have pushed.




// Last operation is to add 1 to hit the maximum value (since Math.random() never quite reaches 1). This ensures all 100 numbers (1 through 100) are equally reachable.eg 39 => 40

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nearly. The order of your four steps is right now. But the last step in line 4 is + minimum, not + 1. Here minimum is 1, so the two look the same. What would this step add if minimum were 10?

There is a + 1 in line 4 as well, inside (maximum - minimum + 1). Which of the two makes 100 reachable?

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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