Skip to content

LONDON | MAY-2025 | HAKAN MURAT KAVUT | MODULE DATA-GROUPS SPRINT-2 #568

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 4 commits into
base: main
Choose a base branch
from

Conversation

hmkavut
Copy link

@hmkavut hmkavut commented Jul 9, 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_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

In this PR, I implemented function in Sprint 2 folder and test cases are written for these functions

Questions

Ask any questions you have for your reviewer.

@hmkavut hmkavut added the Needs Review Participant to add when requesting review label Jul 9, 2025
@day-lee day-lee self-requested a review July 18, 2025 11:35
@day-lee day-lee added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Jul 18, 2025
@@ -1,3 +1,8 @@
function contains() {}
function contains(list, prop) {
if (typeof list !== "object" || list === null || Array.isArray(list))
Copy link

Choose a reason for hiding this comment

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

Does typeof list !== "object" check weather the variable list is not an object? like string or another type?

// implementation here
function createLookup(countryCurrencyPairs) {
const queryParams = {};
for (let i = 0; i < countryCurrencyPairs.length; i++) {
Copy link

Choose a reason for hiding this comment

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

Good job! It works as intended. As a challenge, would you like to try to refactor the code using for...of loop? It's up to you.

@@ -3,10 +3,11 @@ function parseQueryString(queryString) {
if (queryString.length === 0) {
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 day-lee added Reviewed Volunteer to add when completing a review and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 23, 2025
for (const char of input) {
queryParams[char]=0;
}
for (const char of input) {
Copy link

Choose a reason for hiding this comment

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

I think this code can be combined with the upper for...of loop using or operator ||. Can you think of less repetitive way to implement it?

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