Skip to content

ZA-ITP-May-2025 | Christian Mayamba | Module-Data-Groups | Week 2 #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

c-mayamba
Copy link

@c-mayamba c-mayamba commented Jul 25, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@c-mayamba c-mayamba added the Needs Review Participant to add when requesting review label Jul 25, 2025
@day-lee day-lee added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 30, 2025
@c-mayamba c-mayamba added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jul 30, 2025
Comment on lines +8 to +15
for (const item of array) {
if (result[item]) {
result[item] = result[item] + 1;
} else {
result[item] = 1;
}
}

Copy link

Choose a reason for hiding this comment

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

Well done! As a challenge, can you refactor the code with an array method and ternary operator so the code can be more simple and concise?

Copy link

Choose a reason for hiding this comment

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

Good job!

In the real world, URLs are usually encoded with percent encoding to represent special characters. In URL, & can be used as a separator (key=value&key=value...) or special character within a key or value. if we were to use & as a special character, we need to encode it.

Can you refactor the code so that parseQueryString("a%25b=c%26d") results in { "a%b": "c&d" }?
FYI, %25 is same as %, %26 is same as &

@day-lee
Copy link

day-lee commented Jul 30, 2025

Hi @c-mayamba. Thank you for refactoring the code accordingly. I left two more reviews.

@day-lee day-lee added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 30, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants