Skip to content

West Midlands | 26-Jan-ITP | Fida H Ali Zada | Sprint 1 | coursework/sprint-1#929

Open
alizada-dev wants to merge 7 commits intoCodeYourFuture:mainfrom
alizada-dev:coursework/sprint-1
Open

West Midlands | 26-Jan-ITP | Fida H Ali Zada | Sprint 1 | coursework/sprint-1#929
alizada-dev wants to merge 7 commits intoCodeYourFuture:mainfrom
alizada-dev:coursework/sprint-1

Conversation

@alizada-dev
Copy link

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

I created a new branch 'coursework/sprint-1' from the main branch and completed all the coursework in the sprint-1 folder.

@alizada-dev alizada-dev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 4, 2026
const dir = ;
const ext = ;
const dir = filePath.slice(1, lastSlashIndex);
const ext = filePath.slice(lastSlashIndex + 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you express the statement on line 21 so that it works for any path?
For example, "/tmp/my-project/package.json"

Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice if you can show the new code here so that I don't have to locate the code in the file.

Copy link
Author

Choose a reason for hiding this comment

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

const ext = filePath.split('/').pop().split('.').pop();

Copy link
Contributor

Choose a reason for hiding this comment

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

This work but it seems a bit overdone. Can you explain how this expression work?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, sir. It is a bit overdone, but I could not find another solution because I didn't use AI.

So, this part filePath.split('/'), splits the whole file path that has slashes. And pop() takes out the last part, which in this example is package.json. Again, we split this part that has a dot. In this case, it becomes "package" "json". Finally, the last pop() will take the ext, which is json.

So, it works for all different paths.

Copy link
Contributor

Choose a reason for hiding this comment

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

A more direct approach is to use filePath.lastIndexOf(). The original code has illustrated how to use it.

Why don't you use AI? It's ok to use AI, especially when you had already figured out an approach, to learn how else you could solve the problem.

@cjyuan cjyuan 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 Feb 12, 2026
@alizada-dev alizada-dev added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Feb 14, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Feb 14, 2026

Can you respond to each of my comment/question so that I don't have to search your code to find what you have changed?

@cjyuan cjyuan 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 Feb 14, 2026
@alizada-dev alizada-dev added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Feb 14, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Feb 15, 2026

Software development is not just about writing code that works.
It's also important to know the programming terminology so that you can more effectively communicate with developers.

Can you continue to respond to comments in those unresolved conversation?

@cjyuan cjyuan 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 Feb 15, 2026
@alizada-dev
Copy link
Author

Yes, sir. I just got time to open my laptop. I am replying now. Thank you for pointing out those points.

@alizada-dev alizada-dev added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Feb 15, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Feb 15, 2026

All comments addressed. Well done, and keep up the good work!

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants